home *** CD-ROM | disk | FTP | other *** search
/ Champak 130 / Vol 130.iso / games / atlantis.swf / scripts / frame_3 / DoAction.as
Encoding:
Text File  |  2008-11-13  |  82.4 KB  |  3,068 lines

  1. function InitRound()
  2. {
  3.    lowtime_s = new Sound();
  4.    lowtime_s.attachSound("lowtime");
  5.    notBlock = false;
  6.    stats_s.stop();
  7.    Mouse.removeListener(oMouse);
  8.    _root.attachMovie("panelleft","panelleft",_root.getNextHighestDepth());
  9.    _root.attachMovie(countries[RoundCountry].substr(0,1).toLowerCase() + "shad","shadow",_root.getNextHighestDepth());
  10.    _root.attachMovie(countries[RoundCountry],"gamepanel",_root.getNextHighestDepth());
  11.    _root.attachMovie("timeline","TIME",_root.getNextHighestDepth());
  12.    _root.attachMovie("Score","SCORE",_root.getNextHighestDepth());
  13.    _root.attachMovie("menubutton","button",_root.getNextHighestDepth());
  14.    _root.attachMovie("smalltext","country1",_root.getNextHighestDepth());
  15.    _root.attachMovie("smalltext","sity1",_root.getNextHighestDepth());
  16.    TextShow(country1,countries[RoundCountry],"l",0,0,1);
  17.    TextShow(sity1,sities[RoundCountry][RoundSity],"l",0,0,1);
  18.    country1._x = 95;
  19.    country1._y = 3;
  20.    sity1._x = 95;
  21.    sity1._y = 217;
  22.    TIME._x = 224;
  23.    TIME._y = 327;
  24.    gamepanel._x = 194;
  25.    SCORE._y = 242;
  26.    SCORE._x = 100;
  27.    shadow._x = ArtX;
  28.    shadow._y = ArtY;
  29.    button._x = 40;
  30.    button._y = 315;
  31.    button.onPress = bRel;
  32.    button.onRelease = MenuPress;
  33.    button.onReleaseOutside = MenuPress;
  34.    TextShow(SCORE,String(score),"sc",0,0,1);
  35.    Nomer = 4 + RoundCountry;
  36.    delete Matrix;
  37.    Matrix = new Array();
  38.    generateMatrix(RoundCountry,RoundSity,Matrix);
  39.    GlobalX = 270 - (Size - 29) * 7 - (Matrix[0].length - 7) * (Size / 2);
  40.    GlobalY = 75 - (Size - 29) * 7 - (Matrix.length - 7) * (Size / 2);
  41.    _root.attachMovie("smalltext","hamn",_root.getNextHighestDepth(),{_x:HamX + 25,_y:HamY + 20});
  42.    _root.attachMovie("smalltext","dign",_root.getNextHighestDepth(),{_x:DigX + 25,_y:DigY + 20});
  43.    _root.attachMovie("smalltext","watn",_root.getNextHighestDepth(),{_x:WatX + 25,_y:WatY + 20});
  44.    _root.attachMovie("smalltext","lamn",_root.getNextHighestDepth(),{_x:LamX + 25,_y:LamY + 20});
  45.    if(Hammer)
  46.    {
  47.       _root.attachMovie("hammer","hammer",_root.getNextHighestDepth());
  48.       hammer._x = HamX;
  49.       hammer._y = HamY;
  50.       hammer.onPress = onHammerClick;
  51.       TextShow(hamn,"x" + Hammer,"h",0,0,0);
  52.    }
  53.    if(Watch)
  54.    {
  55.       _root.attachMovie("watch","watch",_root.getNextHighestDepth());
  56.       watch._x = WatX;
  57.       watch._y = WatY;
  58.       watch.onPress = onWatchClick;
  59.       TextShow(watn,"x" + Watch,"h",0,0,0);
  60.    }
  61.    if(Digger)
  62.    {
  63.       _root.attachMovie("digger","digger",_root.getNextHighestDepth());
  64.       digger._x = DigX;
  65.       digger._y = DigY;
  66.       digger.onPress = onDiggerClick;
  67.       TextShow(dign,"x" + Digger,"h",0,0,0);
  68.    }
  69.    if(Lamp)
  70.    {
  71.       _root.attachMovie("lamp","lamp",_root.getNextHighestDepth());
  72.       lamp._x = LamX;
  73.       lamp._y = LamY;
  74.       lamp.onPress = onLampClick;
  75.       TextShow(lamn,"x" + Lamp,"h",0,0,0);
  76.    }
  77.    ResetTimer();
  78.    StopTimer();
  79.    Add = Matches = Chain = MaxChain = Tiles = EndX = 0;
  80.    Blink = "no";
  81.    Mouse.show();
  82.    DrawLife();
  83.    DrawArt();
  84.    PreDraw();
  85. }
  86. function CallFall()
  87. {
  88.    clearInterval(ifall);
  89.    ifall = setInterval(function()
  90.    {
  91.       clearInterval(ifall);
  92.       FallDown(Matrix);
  93.    }
  94.    ,100);
  95. }
  96. function bRel()
  97. {
  98.    if(notBlock && redytoend && !moveart)
  99.    {
  100.       inMenu = true;
  101.       this._y += 3;
  102.    }
  103. }
  104. function ClearRound(Matrix)
  105. {
  106.    StopHint();
  107.    hamn.removeMovieClip();
  108.    lamn.removeMovieClip();
  109.    dign.removeMovieClip();
  110.    watn.removeMovieClip();
  111.    country1.removeMovieClip();
  112.    sity1.removeMovieClip();
  113.    clearInterval(DD);
  114.    clearINterval(HHH);
  115.    SCORE.removeMovieClip();
  116.    TIME.removeMovieClip();
  117.    gamepanel.removeMovieClip();
  118.    shadow.removeMovieClip();
  119.    panelleft.removeMovieClip();
  120.    hammer.removeMovieClip();
  121.    digger.removeMovieClip();
  122.    watch.removeMovieClip();
  123.    lamp.removeMovieClip();
  124.    ham.removeMovieClip();
  125.    button.removeMovieClip();
  126.    bl.removeMovieClip();
  127.    mainmenu.removeMovieClip();
  128.    var i = 0;
  129.    while(i < Matrix.length)
  130.    {
  131.       var j = 0;
  132.       while(j < Matrix[i].length)
  133.       {
  134.          var temp = FindName(i,j);
  135.          eval(temp).removeMovieClip();
  136.          eval("s" + j).removeMovieClip();
  137.          eval(temp + "fon").removeMovieClip();
  138.          clearInterval(_root["m" + temp]);
  139.          clearInterval(_root["b" + temp]);
  140.          clearInterval(_root[MATP + Name]);
  141.          clearInterval(_root["m" + i + j]);
  142.          clearInterval(_root["m" + String(eval("s" + i + j))]);
  143.          j++;
  144.       }
  145.       i++;
  146.    }
  147.    i = 1;
  148.    while(i < 50)
  149.    {
  150.       var Name = countries[RoundCountry].substr(0,1).toLowerCase() + "slice" + i;
  151.       eval(Name).removeMovieClip();
  152.       eval("heart" + Number(i - 1)).removeMovieClip();
  153.       eval("border" + Number(i - 1)).removeMovieClip();
  154.       eval("corner" + Number(i - 1)).removeMovieClip();
  155.       i++;
  156.    }
  157. }
  158. function InitSound()
  159. {
  160.    Art_s = new Sound();
  161.    Art_s.attachSound("Art.mp3");
  162.    art_s = new Sound();
  163.    art_s.attachSound("artefact");
  164.    bonus_s = new Sound();
  165.    bonus_s.attachSound("bonus");
  166.    digger_s = new Sound();
  167.    digger_s.attachSound("diggers");
  168.    endexplode_s = new Sound();
  169.    endexplode_s.attachSound("endexplode");
  170.    hint_s = new Sound();
  171.    hint_s.attachSound("hint_s");
  172.    lamp_s = new Sound();
  173.    lamp_s.attachSound("lamps");
  174.    lowtime_s = new Sound();
  175.    lowtime_s.attachSound("lowtime");
  176.    match1_s = new Sound();
  177.    match1_s.attachSound("match1");
  178.    match2_s = new Sound();
  179.    match2_s.attachSound("match2");
  180.    stats_s = new Sound();
  181.    stats_s.attachSound("stats");
  182.    time_s = new Sound();
  183.    time_s.attachSound("time");
  184.    no_s = new Sound();
  185.    no_s.attachSound("no");
  186.    yes_s = new Sound();
  187.    yes_s.attachSound("yes");
  188.    click_s = new Sound();
  189.    click_s.attachSound("click");
  190.    hammer_s = new Sound();
  191.    hammer_s.attachSound("hammers");
  192.    scores_s = new Sound();
  193.    scores_s.attachSound("Scores");
  194.    start_s = new Sound();
  195.    start_s.attachSound("start");
  196.    watch_s = new Sound();
  197.    watch_s.attachSound("watchs");
  198. }
  199. function PreDraw()
  200. {
  201.    _root.attachMovie("black","bl",_root.getNextHighestDepth());
  202.    bl._width = 520;
  203.    bl._height = 390;
  204.    bl._alpha = 50;
  205.    bl.useHandCursor = false;
  206.    start_s = new Sound();
  207.    start_s.attachSound("start");
  208.    bl.onPress = function()
  209.    {
  210.       clearInterval(showing);
  211.       clearInterval(showing1);
  212.       clearInterval(showing2);
  213.       bigtext.removeMovieClip();
  214.       var Done = true;
  215.       var i = 0;
  216.       while(i < Matrix.length)
  217.       {
  218.          if(eval("s" + i + "0") != undefined)
  219.          {
  220.             Done = false;
  221.          }
  222.          i++;
  223.       }
  224.       delete start_s;
  225.       if(Done)
  226.       {
  227.          DrawFon(GlobalX,GlobalY,Matrix);
  228.       }
  229.       var i = 0;
  230.       while(i < Matrix.length)
  231.       {
  232.          clearInterval(_root["Fallb" + i]);
  233.          var j = 0;
  234.          while(j < Matrix[0].length)
  235.          {
  236.             eval("s" + i + j)._x = GlobalX + Size * j;
  237.             eval("s" + i + j)._y = GlobalY + i * Size;
  238.             if(Matrix[i][j].substr(1,3) != "sli")
  239.             {
  240.                eval("s" + i + j)._x += Size / 2 - eval("s" + i + j)._width / 2;
  241.                eval("s" + i + j)._y += Size / 2 - eval("s" + i + j)._height / 2;
  242.             }
  243.             eval("s" + i + j)._alpha = 100;
  244.             j++;
  245.          }
  246.          i++;
  247.       }
  248.       ShowBlink();
  249.       TIME.time1._x = 0;
  250.       bl.removeMovieClip();
  251.    };
  252.    var str = countries[RoundCountry] + ", " + sities[RoundCountry][RoundSity] + "|Level " + Number(RoundCountry + 1) + "-" + Number(RoundSity + 1);
  253.    _root.attachMovie("bigtext","bigtext",_root.getNextHighestDepth(),{_x:360,_y:180,_alpha:0});
  254.    if(countries[RoundCountry].length + sities[RoundCountry][RoundSity].length > 13)
  255.    {
  256.       var u = countries[RoundCountry].length + sities[RoundCountry][RoundSity].length - 13;
  257.       bigtext._x -= u * 12;
  258.    }
  259.    TextShow(bigtext,str,"t",5,30,1);
  260.    showing = setInterval(ShowBeginText,10,1);
  261.    showing1 = setInterval(function()
  262.    {
  263.       clearInterval(showing1);
  264.       clearInterval(showing);
  265.       bigtext._alpha = 0;
  266.       if(Life == 0)
  267.       {
  268.          str = nolife;
  269.       }
  270.       else if(Life == 1)
  271.       {
  272.          str = onelife;
  273.       }
  274.       else
  275.       {
  276.          str = Life + manylives;
  277.       }
  278.       TextShow(bigtext,str,"t",0,30,1);
  279.       bigtext._x = 360;
  280.       showing = setInterval(ShowBeginText,10,1);
  281.    }
  282.    ,2500);
  283.    showing2 = setInterval(function()
  284.    {
  285.       clearInterval(showing);
  286.       clearInterval(showing2);
  287.       bigtext.removeMovieClip();
  288.       DrawFon(GlobalX,GlobalY,Matrix);
  289.    }
  290.    ,5000);
  291. }
  292. function ShowBeginText(l)
  293. {
  294.    if(l == 1)
  295.    {
  296.       if(bigtext._alpha >= 100)
  297.       {
  298.          clearInterval(showing);
  299.          showing = setInterval(ShowBeginText,10,-1);
  300.       }
  301.       else
  302.       {
  303.          bigtext._alpha += 2;
  304.       }
  305.    }
  306.    else if(bigtext._alpha <= 3)
  307.    {
  308.       clearInterval(showing);
  309.    }
  310.    else
  311.    {
  312.       bigtext._alpha -= 2;
  313.    }
  314. }
  315. function TextShow(Inside, Str, l, W, H, C)
  316. {
  317.    function Attach(STR)
  318.    {
  319.       Inside.TEXT.attachMovie(STR + l,U,Inside.TEXT.getNextHighestDepth(),{_x:X,_y:Y});
  320.       wid = eval(String(Inside) + ".TEXT." + U)._width;
  321.       X += wid + W;
  322.    }
  323.    var X = 0;
  324.    var Y = 0;
  325.    var L = 0;
  326.    var wid = 0;
  327.    Inside.TEXT.removeMovieClip();
  328.    Inside.createEmptyMovieClip("TEXT",Inside.getNextHighestDepth());
  329.    var i = 0;
  330.    while(i < Str.length)
  331.    {
  332.       var j = Str.substr(i,1).toLowerCase();
  333.       if(j == "|")
  334.       {
  335.          if(C == 1)
  336.          {
  337.             X /= 2;
  338.             var k = 0;
  339.             while(k < Str.length)
  340.             {
  341.                eval(String(Inside) + ".TEXT.t" + k + L)._x -= X;
  342.                k++;
  343.             }
  344.          }
  345.          else if(C == 2)
  346.          {
  347.             var k = 0;
  348.             while(k < Str.length)
  349.             {
  350.                eval(String(Inside) + ".TEXT.t" + k + L)._x -= X;
  351.                k++;
  352.             }
  353.          }
  354.          L++;
  355.          X = 0;
  356.          Y += H;
  357.       }
  358.       else
  359.       {
  360.          var U = "t" + i + L;
  361.          if(j == " ")
  362.          {
  363.             X += eval(String(Inside) + ".TEXT.t00")._width * 3 / 4;
  364.          }
  365.          else if(j == ",")
  366.          {
  367.             Attach("zpt");
  368.          }
  369.          else if(j == ".")
  370.          {
  371.             Attach("dot");
  372.          }
  373.          else if(j == ":")
  374.          {
  375.             Attach("dd");
  376.          }
  377.          else if(j == "-")
  378.          {
  379.             Attach("tire");
  380.          }
  381.          else
  382.          {
  383.             Attach(String(j));
  384.          }
  385.       }
  386.       i++;
  387.    }
  388.    if(C == 1)
  389.    {
  390.       X /= 2;
  391.       var k = 0;
  392.       while(k < Str.length)
  393.       {
  394.          eval(String(Inside) + ".TEXT.t" + k + L)._x -= X;
  395.          k++;
  396.       }
  397.    }
  398.    else if(C == 2)
  399.    {
  400.       var k = 0;
  401.       while(k < Str.length)
  402.       {
  403.          eval(String(Inside) + ".TEXT.t" + k + L)._x -= X;
  404.          k++;
  405.       }
  406.    }
  407.    return L;
  408. }
  409. function ScoreAdd(chk)
  410. {
  411.    var _loc1_ = 5;
  412.    if(chk == "y")
  413.    {
  414.       _loc1_ = 20;
  415.    }
  416.    if(Add > 0)
  417.    {
  418.       score += _loc1_;
  419.       Add -= _loc1_;
  420.       redytoend = false;
  421.       TextShow(SCORE,String(score),"sc",0,0,1);
  422.       if(score >= NextLife)
  423.       {
  424.          Life++;
  425.          if(SoundOn)
  426.          {
  427.             life_s.start();
  428.          }
  429.          NextLife += 35000;
  430.       }
  431.    }
  432.    else
  433.    {
  434.       clearInterval(scoring);
  435.       redytoend = true;
  436.    }
  437. }
  438. function Score(ADD, chk)
  439. {
  440.    Add += ADD;
  441.    var _loc1_ = 0;
  442.    if(Add < 30)
  443.    {
  444.       _loc1_ = 200;
  445.    }
  446.    else if(Add < 100)
  447.    {
  448.       _loc1_ = 20;
  449.    }
  450.    clearInterval(scoring);
  451.    scoring = setInterval(ScoreAdd,_loc1_,chk);
  452. }
  453. function MenuDownload(i, j, str, b)
  454. {
  455.    if(b)
  456.    {
  457.       mainmenu["b" + i].onPress = _root[str];
  458.       TextShow(mainmenu["txt" + i],_root["menubutton" + j],"b",-2,15,1);
  459.       mainmenu["b" + i].onRollOver = function()
  460.       {
  461.          TextShow(mainmenu["txt" + i],_root["menubutton" + j],"l",-1,15,1);
  462.       };
  463.       mainmenu["b" + i].onRollOut = function()
  464.       {
  465.          TextShow(mainmenu["txt" + i],_root["menubutton" + j],"b",-2,15,1);
  466.       };
  467.    }
  468.    else
  469.    {
  470.       mainmenu["b" + i]._visible = false;
  471.    }
  472. }
  473. function MenuPress()
  474. {
  475.    if(inMenu)
  476.    {
  477.       var n = 4;
  478.       var a = String(GetVar("alawar_f"));
  479.       if(a == "0" || a == "false")
  480.       {
  481.          n++;
  482.       }
  483.       var c = String(GetVar("close_f"));
  484.       if(c != "0")
  485.       {
  486.          n++;
  487.       }
  488.       var M = "menu" + n;
  489.       inMenu = false;
  490.       button._y -= 3;
  491.       StopHint();
  492.       StopTimer();
  493.       notBlock = false;
  494.       _root.attachMovie("black","bl",_root.getNextHighestDepth());
  495.       bl._alpha = 50;
  496.       bl._width = 520;
  497.       bl._height = 390;
  498.       _root.attachMovie("mainmenu","mainmenu",_root.getNextHighestDepth(),{_x:200,_y:50});
  499.       mainmenu.mmm.attachMovie(M,"menu",0);
  500.       mainmenu.b1.onPress = FunctionHelp;
  501.       mainmenu.b2.onPress = FunctionSound;
  502.       if(a != "true" && c != "0")
  503.       {
  504.          MenuDownload(3,2,"FunctionDownload",true);
  505.          MenuDownload(4,3,"FunctionNew",true);
  506.          MenuDownload(6,4,"FunctionResume",true);
  507.          MenuDownload(5,6,"FunctionExit",true);
  508.       }
  509.       else if(a != "true" && c == "0")
  510.       {
  511.          MenuDownload(3,2,"FunctionDownload",true);
  512.          MenuDownload(4,3,"FunctionNew",true);
  513.          MenuDownload(5,4,"FunctionResume",true);
  514.          MenuDownload(6,4,"F");
  515.       }
  516.       else if(a == "true" && c != "0")
  517.       {
  518.          MenuDownload(3,3,"FunctionNew",true);
  519.          MenuDownload(5,4,"FunctionResume",true);
  520.          MenuDownload(4,6,"FunctionExit",true);
  521.          MenuDownload(6,6,"F");
  522.       }
  523.       else
  524.       {
  525.          MenuDownload(3,3,"FunctionNew",true);
  526.          MenuDownload(4,4,"FunctionResume",true);
  527.          MenuDownload(5,6,"F");
  528.          MenuDownload(6,6,"F");
  529.       }
  530.       mainmenu.b1.onRollOver = function()
  531.       {
  532.          TextShow(mainmenu.txt1,_root.menubutton0,"l",-1,15,1);
  533.       };
  534.       mainmenu.b1.onRollOut = function()
  535.       {
  536.          TextShow(mainmenu.txt1,_root.menubutton0,"b",-2,15,1);
  537.       };
  538.       TextShow(mainmenu.txt1,_root.menubutton0,"b",-2,15,1);
  539.       if(SoundOn)
  540.       {
  541.          TextShow(mainmenu.txt2,_root.menubutton1,"b",-2,15,1);
  542.          mainmenu.b2.onRollOver = function()
  543.          {
  544.             TextShow(mainmenu.txt2,_root.menubutton1,"l",-1,15,1);
  545.          };
  546.          mainmenu.b2.onRollOut = function()
  547.          {
  548.             TextShow(mainmenu.txt2,_root.menubutton1,"b",-2,15,1);
  549.          };
  550.       }
  551.       else
  552.       {
  553.          TextShow(mainmenu.txt2,_root.menubutton5,"b",-2,15,1);
  554.          mainmenu.b2.onRollOver = function()
  555.          {
  556.             TextShow(mainmenu.txt2,_root.menubutton5,"l",-1,15,1);
  557.          };
  558.          mainmenu.b2.onRollOut = function()
  559.          {
  560.             TextShow(mainmenu.txt2,_root.menubutton5,"b",-2,15,1);
  561.          };
  562.       }
  563.    }
  564. }
  565. function FunctionHelp()
  566. {
  567.    this._y += 3;
  568.    this._parent.txt1._y += 3;
  569.    clearInterval(LLL);
  570.    LLL = setInterval(function()
  571.    {
  572.       clearInterval(LLL);
  573.       _root.attachMovie("helppanel","help",_root.getNextHighestDepth());
  574.    }
  575.    ,300);
  576. }
  577. function FunctionSound()
  578. {
  579.    this._y += 3;
  580.    this._parent.txt2._y += 3;
  581.    SoundOn = !SoundOn;
  582.    if(SoundOn)
  583.    {
  584.       TextShow(mainmenu.txt2,_root.menubutton1,"l",-1,15,1);
  585.       mainmenu.b2.onRollOver = function()
  586.       {
  587.          TextShow(mainmenu.txt2,_root.menubutton1,"l",-1,15,1);
  588.       };
  589.       mainmenu.b2.onRollOut = function()
  590.       {
  591.          TextShow(mainmenu.txt2,_root.menubutton1,"b",-2,15,1);
  592.       };
  593.    }
  594.    else
  595.    {
  596.       TextShow(mainmenu.txt2,_root.menubutton5,"l",-1,15,1);
  597.       mainmenu.b2.onRollOver = function()
  598.       {
  599.          TextShow(mainmenu.txt2,_root.menubutton5,"l",-1,15,1);
  600.       };
  601.       mainmenu.b2.onRollOut = function()
  602.       {
  603.          TextShow(mainmenu.txt2,_root.menubutton5,"b",-2,15,1);
  604.       };
  605.    }
  606. }
  607. function FunctionDownload()
  608. {
  609.    this._y += 3;
  610.    this._parent.txt3._y += 3;
  611.    LLL = setInterval(function()
  612.    {
  613.       clearInterval(LLL);
  614.       if(GetVar("link") == "0")
  615.       {
  616.          getURL(downloadlink,"_blank");
  617.       }
  618.       else
  619.       {
  620.          getURL(GetVar("link"),"");
  621.       }
  622.       if(GetVar("dload_f") != "0")
  623.       {
  624.          getURL("JavaScript:" + GetVar("dload_f") + "()","");
  625.       }
  626.    }
  627.    ,300);
  628. }
  629. function FunctionNew()
  630. {
  631.    this._y += 3;
  632.    this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y = this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y + 3;
  633.    RoundCountry = RoundSity = Hammer = Lamp = Digger = Watch = Chain = Matches = MaxChain = Tiles = EndX = score = 0;
  634.    delete ArtPos;
  635.    ArtPos = new Array();
  636.    InitArt(RoundCountry,RoundSity);
  637.    clearInterval(LLL);
  638.    LLL = setInterval(function()
  639.    {
  640.       clearInterval(LLL);
  641.       ClearRound(Matrix);
  642.       InitRound();
  643.    }
  644.    ,300);
  645. }
  646. function FunctionResume()
  647. {
  648.    this._y += 3;
  649.    this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y = this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y + 3;
  650.    clearInterval(LLL);
  651.    LLL = setInterval(function()
  652.    {
  653.       clearInterval(LLL);
  654.       notBlock = true;
  655.       StartTimer();
  656.       bl.removeMovieClip();
  657.       mainmenu.removeMovieClip();
  658.       nag.removeMovieClip();
  659.       RedyToPlay = true;
  660.       StartHint();
  661.    }
  662.    ,300);
  663. }
  664. function FunctionExit()
  665. {
  666.    this._y += 3;
  667.    this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y = this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y + 3;
  668.    clearInterval(LLL);
  669.    LLL = setInterval(function()
  670.    {
  671.       clearInterval(LLL);
  672.       var _loc1_ = GetVar("close_f");
  673.       getURL("JavaScript:" + _loc1_ + "()","");
  674.    }
  675.    ,500);
  676. }
  677. function DrawArt()
  678. {
  679.    var i = 1;
  680.    while(i <= ArtPos.length)
  681.    {
  682.       if(ArtPos[i].is == true)
  683.       {
  684.          var Name = countries[RoundCountry].substr(0,1).toLowerCase() + "slice" + i;
  685.          var X = ArtPos[Number(Name.substr(6,2))].x;
  686.          var Y = ArtPos[Number(Name.substr(6,2))].y;
  687.          _root.attachMovie(Name,Name,_root.getNextHighestDepth());
  688.       }
  689.       eval(Name)._x = X;
  690.       eval(Name)._y = Y;
  691.       i++;
  692.    }
  693. }
  694. function FGameOver()
  695. {
  696.    Life = 3;
  697.    RoundCountry = RoundSity = Hammer = Lamp = Digger = Watch = Chain = Matches = MaxChain = Tiles = EndX = score = 0;
  698.    delete ArtPos;
  699.    ArtPos = new Array();
  700.    InitArt(RoundCountry,RoundSity);
  701.    ClearRound(Matrix);
  702.    InitRound();
  703. }
  704. function GameOver()
  705. {
  706.    Life--;
  707.    StopTimer();
  708.    bl.removeMovieClip();
  709.    _root.attachMovie("black","bl",_root.getNextHighestDepth(),{_width:520,_height:390,_alpha:0});
  710.    bl.onPress = AAA;
  711.    bl.useHandCursor = false;
  712.    if(Life == -1)
  713.    {
  714.       clearInterval(ER);
  715.       RoundCountry = MaxC + 1;
  716.       RoundSity = 99;
  717.       ER = setInterval(EndRound,20,Matrix);
  718.    }
  719.    else
  720.    {
  721.       clearing = setInterval(function()
  722.       {
  723.          if(!Fall)
  724.          {
  725.             clearInterval(clearing);
  726.             ClearRound(Matrix);
  727.             InitRound();
  728.          }
  729.       }
  730.       ,20);
  731.    }
  732. }
  733. function Timing()
  734. {
  735.    var temp = 100 * (EndTime - getTimer()) / totaltime;
  736.    TIME.time1._x = (temp - 100) * 270 / 100;
  737.    if(temp < 1)
  738.    {
  739.       GameOver();
  740.    }
  741.    else if(temp < 20)
  742.    {
  743.       if(SoundOn && lowtime_s.position == 0)
  744.       {
  745.          lowtime_s.start();
  746.       }
  747.       if(warningtime)
  748.       {
  749.          warningtime = false;
  750.          _root.attachMovie("timewarn","warn",_root.getNextHighestDepth());
  751.          warn._xscale = temp;
  752.          warn._x = 224;
  753.          warn._y = 327;
  754.       }
  755.       else
  756.       {
  757.          warn.removeMovieClip();
  758.          warningtime = true;
  759.       }
  760.       if(htime)
  761.       {
  762.          htime = false;
  763.          clearInterval(HHH);
  764.          HHH = setInterval(Hints,50,"time");
  765.       }
  766.    }
  767.    updateAfterEvent();
  768. }
  769. function DrawLife()
  770. {
  771.    var i = 0;
  772.    while(i < 3)
  773.    {
  774.       eval("heart" + i).removeMovieClip;
  775.       i++;
  776.    }
  777.    var i = 0;
  778.    while(i < Life && i < 3)
  779.    {
  780.       var X = 76;
  781.       var Y = 277;
  782.       _root.attachMovie("heart","heart" + i,_root.getNextHighestDepth());
  783.       eval("heart" + i)._x = X + i * 15;
  784.       eval("heart" + i)._y = Y;
  785.       i++;
  786.    }
  787. }
  788. function ResetTimer()
  789. {
  790.    clearInterval(TI);
  791.    totaltime = Number(sitytime[RoundCountry][RoundSity]) * 1000;
  792.    EndTime = Number(getTimer()) + totaltime;
  793.    stopped = 0;
  794.    StartTimer();
  795. }
  796. function StartTimer()
  797. {
  798.    if(stopped)
  799.    {
  800.       EndTime += getTimer() - stopped;
  801.       BeginTime += getTimer() - stopped;
  802.       stopped = 0;
  803.    }
  804.    clearInterval(TI);
  805.    TI = setInterval(Timing,100);
  806. }
  807. function StopTimer()
  808. {
  809.    StopHint();
  810.    stopped = getTimer();
  811.    clearInterval(TI);
  812. }
  813. function gen(Matrix)
  814. {
  815.    Line = new Array("slide2","slide2","slide3","slide4");
  816.    Matrix[0] = Line;
  817.    Line = new Array("slide1","hammer","digger","slide2");
  818.    Matrix[1] = Line;
  819.    Line = new Array("slide3","slide2","slide2","slide1");
  820.    Matrix[2] = Line;
  821. }
  822. function InitArt(Country, Sity)
  823. {
  824.    function PUSH(x, y)
  825.    {
  826.       Line = new Array("x","y","is");
  827.       Line.x = x + ArtX;
  828.       Line.y = y + ArtY;
  829.       ArtPos.push(Line);
  830.    }
  831.    var Line = new Array();
  832.    if(Country == 0)
  833.    {
  834.       PUSH(0,0);
  835.       PUSH(56,26);
  836.       PUSH(78,26);
  837.       PUSH(42,39);
  838.       PUSH(54,37);
  839.       PUSH(77,37);
  840.       PUSH(104,37);
  841.       PUSH(34,63);
  842.       PUSH(53,63);
  843.       PUSH(77,63);
  844.       PUSH(101,63);
  845.       PUSH(35,87);
  846.       PUSH(52,86);
  847.       PUSH(77,87);
  848.       PUSH(103,87);
  849.       PUSH(54,112);
  850.       PUSH(77,112);
  851.    }
  852.    else if(Country == 1)
  853.    {
  854.       PUSH(0,0);
  855.       PUSH(93,130);
  856.       PUSH(54,93);
  857.       PUSH(56,56);
  858.       PUSH(13,57);
  859.       PUSH(30,53);
  860.       PUSH(31,81);
  861.       PUSH(81,4);
  862.       PUSH(39,61);
  863.       PUSH(95,81);
  864.       PUSH(74,127);
  865.       PUSH(63,134);
  866.       PUSH(77,134);
  867.       PUSH(42,16);
  868.       PUSH(67,41);
  869.       PUSH(61,3);
  870.       PUSH(97,55);
  871.       PUSH(57,30);
  872.       PUSH(126,51);
  873.       PUSH(79,31);
  874.       PUSH(109,51);
  875.       PUSH(75,76);
  876.       PUSH(17,82);
  877.       PUSH(31,29);
  878.       PUSH(124,97);
  879.       PUSH(27,108);
  880.       PUSH(12,35);
  881.       PUSH(83,54);
  882.       PUSH(129,82);
  883.       PUSH(94,104);
  884.       PUSH(42,104);
  885.       PUSH(62,116);
  886.       PUSH(53,81);
  887.       PUSH(111,78);
  888.       PUSH(109,105);
  889.       PUSH(43,125);
  890.       PUSH(75,101);
  891.       PUSH(83,118);
  892.    }
  893.    else
  894.    {
  895.       PUSH(0,0);
  896.       PUSH(62,46);
  897.       PUSH(30,98);
  898.       PUSH(57,135);
  899.       PUSH(104,139);
  900.       PUSH(53,90);
  901.       PUSH(79,87);
  902.       PUSH(111,46);
  903.       PUSH(20,7);
  904.       PUSH(85,53);
  905.       PUSH(78,64);
  906.       PUSH(83,112);
  907.       PUSH(36,113);
  908.       PUSH(62,66);
  909.       PUSH(49,118);
  910.       PUSH(23,60);
  911.       PUSH(46,72);
  912.       PUSH(24,81);
  913.       PUSH(59,108);
  914.       PUSH(108,114);
  915.       PUSH(103,69);
  916.       PUSH(85,128);
  917.       PUSH(33,1);
  918.       PUSH(127,136);
  919.       PUSH(79,137);
  920.       PUSH(37,139);
  921.       PUSH(38,42);
  922.       PUSH(94,60);
  923.       PUSH(103,92);
  924.       PUSH(31,24);
  925.       PUSH(13,34);
  926.    }
  927. }
  928. function Blow(i, j)
  929. {
  930.    var temp = Matrix[i][j];
  931.    var slide = eval(FindName(i,j));
  932.    if(temp.substr(0,5) == "lock1")
  933.    {
  934.       Matrix[i][j] = temp.substr(5,10);
  935.       slide.l.removeMovieClip();
  936.       InitSlide(slide);
  937.    }
  938.    else if(temp.substr(0,5) == "lock2")
  939.    {
  940.       Matrix[i][j] = "lock1" + temp.substr(5,10);
  941.       slide.l.removeMovieClip();
  942.       slide.attachMovie("lock1","l",_root.getNextHighestDepth(),{_width:Size,_height:Size});
  943.    }
  944.    else
  945.    {
  946.       Tiles++;
  947.       Score(5 * (Chain + 1));
  948.       var Depth = slide.getDepth();
  949.       slide.removeMovieClip();
  950.       var Name = FindName(i,j);
  951.       eval(Name + "b").removeMovieClip();
  952.       _root.attachMovie("blow",Name + "b",Depth);
  953.       eval(Name + "b").txt.txt.text = 5 * (Chain + 1);
  954.       eval(Name + "b")._x = GlobalX + j * Size;
  955.       eval(Name + "b")._y = GlobalY + i * Size;
  956.       Matrix[i][j] += "b";
  957.       _root["b" + Name] = setInterval(function()
  958.       {
  959.          Matrix[i][j] = "no";
  960.          clearInterval(_root["b" + FindName(i,j)]);
  961.       }
  962.       ,0);
  963.    }
  964. }
  965. function FindChain(Matrix)
  966. {
  967.    var _loc5_ = false;
  968.    var _loc2_ = 0;
  969.    while(_loc2_ < Matrix.length)
  970.    {
  971.       var _loc1_ = 0;
  972.       while(_loc1_ < Matrix[_loc2_].length)
  973.       {
  974.          var _loc4_ = Matrix[_loc2_][_loc1_];
  975.          if(_loc4_.substr(0,4) == "lock")
  976.          {
  977.             _loc4_ = _loc4_.substr(5,10);
  978.          }
  979.          else
  980.          {
  981.             _loc4_ = Matrix[_loc2_][_loc1_].substr(0,6);
  982.          }
  983.          if(_loc4_.substr(0,1) == "s")
  984.          {
  985.             if((Matrix[_loc2_ - 1][_loc1_].substr(0,6) == _loc4_ || Matrix[_loc2_ - 1][_loc1_].substr(5,10) == _loc4_) && (Matrix[_loc2_ + 1][_loc1_].substr(0,6) == _loc4_ || Matrix[_loc2_ + 1][_loc1_].substr(5,10) == _loc4_))
  986.             {
  987.                if(Matrix[_loc2_ - 1][_loc1_].substr(6,1) != "b")
  988.                {
  989.                   Blow(_loc2_ - 1,_loc1_);
  990.                }
  991.                if(Matrix[_loc2_][_loc1_].substr(6,1) != "b")
  992.                {
  993.                   Blow(_loc2_,_loc1_);
  994.                }
  995.                if(Matrix[_loc2_ + 1][_loc1_].substr(6,1) != "b")
  996.                {
  997.                   Blow(_loc2_ + 1,_loc1_);
  998.                }
  999.                _loc5_ = true;
  1000.             }
  1001.             if((Matrix[_loc2_][_loc1_ - 1].substr(0,6) == _loc4_ || Matrix[_loc2_][_loc1_ - 1].substr(5,10) == _loc4_) && (Matrix[_loc2_][_loc1_ + 1].substr(0,6) == _loc4_ || Matrix[_loc2_][_loc1_ + 1].substr(5,10) == _loc4_))
  1002.             {
  1003.                if(Matrix[_loc2_][_loc1_ - 1].substr(6,1) != "b")
  1004.                {
  1005.                   Blow(_loc2_,_loc1_ - 1);
  1006.                }
  1007.                if(Matrix[_loc2_][_loc1_].substr(6,1) != "b")
  1008.                {
  1009.                   Blow(_loc2_,_loc1_);
  1010.                }
  1011.                if(Matrix[_loc2_][_loc1_ + 1].substr(6,1) != "b")
  1012.                {
  1013.                   Blow(_loc2_,_loc1_ + 1);
  1014.                }
  1015.                _loc5_ = true;
  1016.             }
  1017.          }
  1018.          _loc1_ = _loc1_ + 1;
  1019.       }
  1020.       _loc2_ = _loc2_ + 1;
  1021.    }
  1022.    return _loc5_;
  1023. }
  1024. function FallBegin(x, j, Matrix)
  1025. {
  1026.    var l = 5;
  1027.    var k = 0;
  1028.    mmm += 270 * l / (Matrix[0].length * 100);
  1029.    while(eval(FindName(k,j)) == undefined)
  1030.    {
  1031.       k++;
  1032.    }
  1033.    if(eval(FindName(k,j))._y >= GlobalY + k * Size)
  1034.    {
  1035.       clearInterval(_root["Flallb" + j]);
  1036.       AdjustSlides(j);
  1037.       j++;
  1038.       mmm = 270 * j / Matrix[0].length - 270;
  1039.       if(j != Matrix[0].length)
  1040.       {
  1041.          if(SoundOn && x != GlobalY)
  1042.          {
  1043.             start_s.start();
  1044.          }
  1045.          _root["Flallb" + j] = setInterval(FallBegin,Speed,x,j,Matrix);
  1046.       }
  1047.       else
  1048.       {
  1049.          bl.removeMovieClip();
  1050.          BeginTime = getTimer();
  1051.          notStop = redytoend = true;
  1052.          ShowBlink();
  1053.          if(RoundSity == 0 && RoundCountry == 0 && hbegin)
  1054.          {
  1055.             hbegin = false;
  1056.             clearInterval(HHH);
  1057.             HHH = setInterval(Hints,50,"begin");
  1058.          }
  1059.          Fall = moveart = hammeruse = false;
  1060.       }
  1061.    }
  1062.    else
  1063.    {
  1064.       var i = 0;
  1065.       while(i < Matrix.length)
  1066.       {
  1067.          if(mmm < 270)
  1068.          {
  1069.             TIME.time1._x = mmm;
  1070.          }
  1071.          eval(FindName(i,j))._y = eval(FindName(i,j))._y + l;
  1072.          eval(FindName(i,j))._alpha = 100 - (GlobalY + k * Size - eval(FindName(k,j))._y);
  1073.          i++;
  1074.       }
  1075.    }
  1076.    updateAfterEvent();
  1077. }
  1078. function AdjustSlides(j)
  1079. {
  1080.    var i = 0;
  1081.    while(i <= Matrix.length)
  1082.    {
  1083.       if(Matrix[i][j].substr(1,3) != "sli")
  1084.       {
  1085.          eval("s" + i + j)._x = GlobalX + Size * j + Size / 2 - eval("s" + i + j)._width / 2;
  1086.          eval("s" + i + j)._y = GlobalY + Size * i + Size / 2 - eval("s" + i + j)._height / 2;
  1087.       }
  1088.       i++;
  1089.    }
  1090. }
  1091. function ShowBlink()
  1092. {
  1093.    var k = 0;
  1094.    clearInterval(delays);
  1095.    delays = setInterval(function()
  1096.    {
  1097.       var i = 0;
  1098.       while(i <= k)
  1099.       {
  1100.          var j = 0;
  1101.          while(j <= k)
  1102.          {
  1103.             if(i + j == k && Matrix[i][j] != "0" && Matrix[i][j] != undefined)
  1104.             {
  1105.                _root.attachMovie("shine1","si" + i + j,_root.getNextHighestDepth(),{_x:GlobalX + j * Size,_y:GlobalY + i * Size});
  1106.                if(eval("s" + i + j).hitTest(hints))
  1107.                {
  1108.                   eval("si" + i + j).removeMovieClip();
  1109.                }
  1110.             }
  1111.             j++;
  1112.          }
  1113.          i++;
  1114.       }
  1115.       if(k == Matrix.length + Matrix[0].length - 2)
  1116.       {
  1117.          clearInterval(delays);
  1118.          notBlock = true;
  1119.       }
  1120.       else
  1121.       {
  1122.          k++;
  1123.       }
  1124.    }
  1125.    ,60);
  1126. }
  1127. function DrawArt1(i, j)
  1128. {
  1129.    _root.createEmptyMovieClip("s" + i + j,_root.getNextHighestDepth(),{_x:Size * j + GlobalX,_y:Size * i + GlobalY});
  1130.    eval("s" + i + j).attachMovie(Matrix[i][j],"mask",eval("s" + i + j).getNextHighestDepth());
  1131.    eval("s" + i + j).attachMovie("art","art",eval("s" + i + j).getNextHighestDepth());
  1132.    eval("s" + i + j).art._width = eval("s" + i + j).mask._width;
  1133.    if(eval("s" + i + j).art._width < Size / 2)
  1134.    {
  1135.       eval("s" + i + j).art._width = Size * 2 / 3;
  1136.    }
  1137.    eval("s" + i + j).art._height = eval("s" + i + j).mask._height;
  1138.    eval("s" + i + j).art._x = eval("s" + i + j).mask._x = Size / 2 - eval("s" + i + j).art._width / 2;
  1139.    eval("s" + i + j).art._y = eval("s" + i + j).mask._y = Size / 2 - eval("s" + i + j).art._height / 2;
  1140. }
  1141. function DrawMatrix(x, y, Matrix)
  1142. {
  1143.    i = 0;
  1144.    while(i < Matrix.length)
  1145.    {
  1146.       j = 0;
  1147.       while(j < Matrix[i].length)
  1148.       {
  1149.          if(Matrix[i][j].substr(0,4) != "lock")
  1150.          {
  1151.             if(Matrix[i][j].substr(1,5) == "slice")
  1152.             {
  1153.                eval(Matrix[i][j]).removeMovieClip();
  1154.                DrawArt1(i,j);
  1155.             }
  1156.             else if(Matrix[i][j].substr(0,5) != "slide")
  1157.             {
  1158.                _root.attachMovie(Matrix[i][j],"s" + i + j,_root.getNextHighestDepth());
  1159.             }
  1160.             else
  1161.             {
  1162.                _root.attachMovie(Matrix[i][j],"s" + i + j,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
  1163.             }
  1164.             eval("s" + i + j)._x = x + j * Size;
  1165.             eval("s" + i + j)._y = y + i * Size;
  1166.             if(Matrix[i][j].substr(1,3) != "sli")
  1167.             {
  1168.                eval("s" + i + j)._x += Size / 2 - eval("s" + i + j)._width / 2;
  1169.             }
  1170.             eval("s" + i + j)._alpha = 0;
  1171.             InitSlide("s" + i + j);
  1172.             if(Matrix[i][j] == "hammer" && hhammer)
  1173.             {
  1174.                hhammer = false;
  1175.                clearInterval(HHH);
  1176.                HHH = setInterval(Hints,50,"hammer");
  1177.             }
  1178.             else if(Matrix[i][j] == "digger" && hdigger)
  1179.             {
  1180.                hdigger = false;
  1181.                clearInterval(HHH);
  1182.                HHH = setInterval(Hints,50,"digger");
  1183.             }
  1184.             else if(Matrix[i][j] == "watch" && hwatch)
  1185.             {
  1186.                hwatch = false;
  1187.                clearInterval(HHH);
  1188.                HHH = setInterval(Hints,50,"watch");
  1189.             }
  1190.             else if(Matrix[i][j] == "lamp" && hlamp)
  1191.             {
  1192.                hlamp = false;
  1193.                clearInterval(HHH);
  1194.                HHH = setInterval(Hints,50,"lamp");
  1195.             }
  1196.          }
  1197.          else
  1198.          {
  1199.             var Lock = Matrix[i][j].substr(0,5);
  1200.             var slide = Matrix[i][j].substr(5,10);
  1201.             _root.attachMovie(slide,"s" + i + j,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
  1202.             eval("s" + i + j).attachMovie(Lock,"l",_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
  1203.             eval("s" + i + j)._alpha = 0;
  1204.             eval("s" + i + j)._x = x + j * Size;
  1205.             eval("s" + i + j)._y = y + i * Size;
  1206.          }
  1207.          j++;
  1208.       }
  1209.       i++;
  1210.    }
  1211.    mmm = -270;
  1212.    if(SoundOn && y != GlobalY)
  1213.    {
  1214.       start_s.start();
  1215.    }
  1216.    Flallb0 = setInterval(FallBegin,Speed,y,0,Matrix);
  1217. }
  1218. function InitSlide(slide)
  1219. {
  1220.    eval(slide).onPress = Press;
  1221.    eval(slide).onRelease = Release;
  1222.    eval(slide).onReleaseOutside = Release;
  1223.    eval(slide).onRollOver = OverMove;
  1224.    eval(slide).onRollOut = OutMove;
  1225.    eval(slide).useHandCursor = false;
  1226.    eval(slide).tabEnabled = false;
  1227. }
  1228. function DrawFon(x, y, Matrix)
  1229. {
  1230.    var l = 0;
  1231.    var k = 0;
  1232.    i = 0;
  1233.    while(i < Matrix.length)
  1234.    {
  1235.       j = 0;
  1236.       while(j < Matrix[i].length)
  1237.       {
  1238.          if(Matrix[i][j] != "0")
  1239.          {
  1240.             _root.attachMovie("fon","s" + i + j + "fon",_root.getNextHighestDepth(),{_width:Size,_height:Size});
  1241.             eval("s" + i + j + "fon")._x = j * Size + x;
  1242.             eval("s" + i + j + "fon")._y = i * Size + y;
  1243.             eval("s" + i + j + "fon").gotoAndStop(1);
  1244.             eval("s" + i + j + "fon")._width = Size + 1;
  1245.             eval("s" + i + j + "fon")._height = Size + 1;
  1246.             if(Matrix[i - 1][j] == "0" || Matrix[i - 1][j] == undefined)
  1247.             {
  1248.                _root.attachMovie("border","border" + l,_root.getNextHighestDepth(),{_height:Size});
  1249.                eval("border" + l)._rotation = -90;
  1250.                eval("border" + l)._x = j * Size + x;
  1251.                eval("border" + l)._y = i * Size + y - 2;
  1252.                l++;
  1253.                if(Matrix[i][j - 1] == "0" || Matrix[i][j - 1] == undefined)
  1254.                {
  1255.                   _root.attachMovie("corner","corner" + k,_root.getNextHighestDepth(),{_x:j * Size + x - 5,_y:i * Size + y - 5});
  1256.                   k++;
  1257.                }
  1258.                if(Matrix[i][j + 1] == "0" || Matrix[i][j + 1] == undefined)
  1259.                {
  1260.                   _root.attachMovie("corner","corner" + k,_root.getNextHighestDepth(),{_x:(j + 1) * Size + x + 5.5,_y:i * Size + y - 5,_rotation:90});
  1261.                   k++;
  1262.                }
  1263.             }
  1264.             if(Matrix[i + 1][j] == "0" || Matrix[i + 1][j] == undefined)
  1265.             {
  1266.                _root.attachMovie("border","border" + l,_root.getNextHighestDepth(),{_height:Size});
  1267.                eval("border" + l)._rotation = -90;
  1268.                eval("border" + l)._x = j * Size + x;
  1269.                eval("border" + l)._y = (i + 1) * Size + y + 3;
  1270.                l++;
  1271.                if(Matrix[i][j - 1] == "0" || Matrix[i][j - 1] == undefined)
  1272.                {
  1273.                   _root.attachMovie("corner","corner" + k,_root.getNextHighestDepth(),{_x:j * Size + x + 0,_y:(i + 1) * Size + y,_rotation:90});
  1274.                   k++;
  1275.                }
  1276.                if(Matrix[i][j + 1] == "0" || Matrix[i][j + 1] == undefined)
  1277.                {
  1278.                   _root.attachMovie("corner","corner" + k,_root.getNextHighestDepth(),{_x:(j + 1) * Size + x + 0.5,_y:(i + 1) * Size + y});
  1279.                   k++;
  1280.                }
  1281.             }
  1282.             if(Matrix[i][j - 1] == "0" || Matrix[i][j - 1] == undefined)
  1283.             {
  1284.                _root.attachMovie("border","border" + l,_root.getNextHighestDepth(),{_height:Size});
  1285.                eval("border" + l)._x = j * Size + x - 2;
  1286.                eval("border" + l)._y = i * Size + y;
  1287.                l++;
  1288.             }
  1289.             if(Matrix[i][j + 1] == "0" || Matrix[i][j + 1] == undefined)
  1290.             {
  1291.                _root.attachMovie("border","border" + l,_root.getNextHighestDepth(),{_height:Size});
  1292.                eval("border" + l)._x = (j + 1) * Size + x + 3;
  1293.                eval("border" + l)._y = i * Size + y;
  1294.                l++;
  1295.             }
  1296.          }
  1297.          j++;
  1298.       }
  1299.       i++;
  1300.    }
  1301.    bl._alpha = 0;
  1302.    DrawMatrix(GlobalX,GlobalY - 100,Matrix);
  1303. }
  1304. function generateMatrix(country, sity, Matrix)
  1305. {
  1306.    Line = new Array();
  1307.    agame = map[country][sity];
  1308.    i = 0;
  1309.    while(i < agame.length)
  1310.    {
  1311.       j = 0;
  1312.       while(j < agame[i].length)
  1313.       {
  1314.          if(agame[i][j] == 1)
  1315.          {
  1316.             do
  1317.             {
  1318.                done = true;
  1319.                var temp1 = Math.round(Math.random() * (Nomer - 1)) + 1;
  1320.                var temp = "slide" + temp1;
  1321.                if(i > 1 && (Matrix[i - 1][j] == temp || Matrix[i - 1][j].substr(5,10) == temp) && (Matrix[i - 2][j] == temp || Matrix[i - 2][j].substr(5,10) == temp))
  1322.                {
  1323.                   done = false;
  1324.                }
  1325.                if(j > 1 && (Line[j - 1] == temp || Line[j - 1].substr(5,10) == temp) && (Line[j - 2] == temp || Line[j - 2].substr(5,10) == temp))
  1326.                {
  1327.                   done = false;
  1328.                }
  1329.                if(agame[i][j + 1].substr(1,1) == temp1 || agame[i + 1][j].substr(1,1) == temp1)
  1330.                {
  1331.                   done = false;
  1332.                }
  1333.             }
  1334.             while(!done);
  1335.             
  1336.             Line[j] = temp;
  1337.          }
  1338.          else
  1339.          {
  1340.             switch(agame[i][j].substr(0,1))
  1341.             {
  1342.                case "x":
  1343.                   temp = "lock1slide" + agame[i][j].substr(1,1);
  1344.                   break;
  1345.                case "X":
  1346.                   temp = "lock2slide" + agame[i][j].substr(1,1);
  1347.                   break;
  1348.                case "b":
  1349.                   lala = agame[i][j].substr(1,1);
  1350.                   if(lala == "1")
  1351.                   {
  1352.                      temp = "hammer";
  1353.                   }
  1354.                   else if(lala == "2")
  1355.                   {
  1356.                      temp = "digger";
  1357.                   }
  1358.                   else if(lala == "3")
  1359.                   {
  1360.                      temp = "watch";
  1361.                   }
  1362.                   else if(lala == "4")
  1363.                   {
  1364.                      temp = "lamp";
  1365.                   }
  1366.                   break;
  1367.                case "a":
  1368.                   temp = countries[country].toLowerCase().substr(0,1) + "slice" + agame[i][j].substr(1,2);
  1369.                   eval(temp).removeMovieClip();
  1370.                   break;
  1371.                default:
  1372.                   temp = "0";
  1373.             }
  1374.             Line[j] = temp;
  1375.          }
  1376.          j++;
  1377.       }
  1378.       Matrix[i] = Line;
  1379.       Line = new Array();
  1380.       i++;
  1381.    }
  1382. }
  1383. function FindIndexX(name)
  1384. {
  1385.    var _loc1_ = name.substr(name.indexOf("s") + 2,1);
  1386.    return _loc1_;
  1387. }
  1388. function FindIndexY(name)
  1389. {
  1390.    var _loc1_ = name.substr(name.indexOf("s") + 3,2);
  1391.    return _loc1_;
  1392. }
  1393. function FindName(x, y)
  1394. {
  1395.    return "s" + x + y;
  1396. }
  1397. function CheckClick(name)
  1398. {
  1399.    Release();
  1400.    if(Blink == "no")
  1401.    {
  1402.       return true;
  1403.    }
  1404.    notBlock = false;
  1405.    i = FindIndexX(String(name));
  1406.    j = FindIndexY(String(name));
  1407.    var _loc1_ = String(Blink);
  1408.    ind1 = FindIndexX(_loc1_);
  1409.    ind2 = FindIndexY(_loc1_);
  1410.    if(i - ind1 == 1 && j - ind2 == 0)
  1411.    {
  1412.       CheckSuccess(i,j,ind1,ind2);
  1413.       MoveDown(_loc1_);
  1414.    }
  1415.    else if(i - ind1 == -1 && j - ind2 == 0)
  1416.    {
  1417.       CheckSuccess(i,j,ind1,ind2);
  1418.       MoveUp(_loc1_);
  1419.    }
  1420.    else if(i - ind1 == 0 && j - ind2 == -1)
  1421.    {
  1422.       CheckSuccess(i,j,ind1,ind2);
  1423.       MoveLeft(_loc1_);
  1424.    }
  1425.    else if(i - ind1 == 0 && j - ind2 == 1)
  1426.    {
  1427.       CheckSuccess(i,j,ind1,ind2);
  1428.       MoveRight(_loc1_);
  1429.    }
  1430.    else
  1431.    {
  1432.       if(i - ind1 == 0 && j - ind2 == 0)
  1433.       {
  1434.          notBlock = true;
  1435.          return true;
  1436.       }
  1437.       notBlock = true;
  1438.       Blink.gotoAndStop(1);
  1439.       return true;
  1440.    }
  1441. }
  1442. function MovingDown(slide, y, chk)
  1443. {
  1444.    var _loc6_ = y + Size;
  1445.    if(slide._y < _loc6_ - N)
  1446.    {
  1447.       if(chk == "fall")
  1448.       {
  1449.          Fall = true;
  1450.       }
  1451.       slide._y += N;
  1452.    }
  1453.    else
  1454.    {
  1455.       if(chk == "0")
  1456.       {
  1457.          notBlock = true;
  1458.       }
  1459.       Fall = false;
  1460.       var _loc3_ = FindIndexX(String(slide));
  1461.       var _loc2_ = FindIndexY(String(slide));
  1462.       _loc3_;
  1463.       var _loc4_ = FindName(_loc3_++,_loc2_);
  1464.       var _loc7_ = FindName(_loc3_,_loc2_);
  1465.       RemoveSlides(_loc4_,_loc7_,chk);
  1466.    }
  1467.    updateAfterEvent();
  1468. }
  1469. function MovingRight(slide, x, chk)
  1470. {
  1471.    var _loc5_ = x + Size;
  1472.    if(slide._x < _loc5_ - N)
  1473.    {
  1474.       slide._x += N;
  1475.    }
  1476.    else
  1477.    {
  1478.       if(chk == "0")
  1479.       {
  1480.          notBlock = true;
  1481.       }
  1482.       var _loc3_ = FindIndexX(String(slide));
  1483.       var _loc2_ = FindIndexY(String(slide));
  1484.       _loc2_;
  1485.       var _loc4_ = FindName(_loc3_,_loc2_++);
  1486.       var _loc6_ = FindName(_loc3_,_loc2_);
  1487.       RemoveSlides(_loc4_,_loc6_,chk);
  1488.    }
  1489.    updateAfterEvent();
  1490. }
  1491. function MovingLeft(slide, x, chk)
  1492. {
  1493.    var _loc5_ = x - Size;
  1494.    if(slide._x > _loc5_ + N)
  1495.    {
  1496.       slide._x -= N;
  1497.    }
  1498.    else
  1499.    {
  1500.       if(chk == "0")
  1501.       {
  1502.          notBlock = true;
  1503.       }
  1504.       var _loc3_ = FindIndexX(String(slide));
  1505.       var _loc2_ = FindIndexY(String(slide));
  1506.       _loc2_;
  1507.       var _loc4_ = FindName(_loc3_,_loc2_--);
  1508.       var _loc6_ = FindName(_loc3_,_loc2_);
  1509.       RemoveSlides(_loc4_,_loc6_,chk);
  1510.    }
  1511.    updateAfterEvent();
  1512. }
  1513. function MovingUp(slide, y, chk)
  1514. {
  1515.    var End = y - Size;
  1516.    if(eval(slide)._y > End + N)
  1517.    {
  1518.       eval(slide)._y -= N;
  1519.    }
  1520.    else
  1521.    {
  1522.       if(chk == "0")
  1523.       {
  1524.          notBlock = true;
  1525.       }
  1526.       var i = FindIndexX(String(slide));
  1527.       var j = FindIndexY(String(slide));
  1528.       var temp = FindName(i--,j);
  1529.       var temp1 = FindName(i,j);
  1530.       RemoveSlides(temp,temp1,chk);
  1531.    }
  1532.    updateAfterEvent();
  1533. }
  1534. function RemoveSlides(slide, slide1, chk)
  1535. {
  1536.    StopHint();
  1537.    redytoend = false;
  1538.    eval(slide + "fon").gotoAndStop(1);
  1539.    eval(slide1 + "fon").gotoAndStop(1);
  1540.    Blink = "no";
  1541.    clearInterval(_root["m" + String(eval(slide))]);
  1542.    clearInterval(_root["m" + String(eval(slide1))]);
  1543.    removeMovieClip(eval(slide));
  1544.    removeMovieClip(eval(slide1));
  1545.    var i = FindIndexX(String(slide));
  1546.    var j = FindIndexY(String(slide));
  1547.    var i1 = FindIndexX(String(slide1));
  1548.    var j1 = FindIndexY(String(slide1));
  1549.    if(chk == "fall")
  1550.    {
  1551.       i++;
  1552.       var slide = FindName(i,j);
  1553.       if(Matrix[i][j].substr(0,4) != "lock")
  1554.       {
  1555.          if(Matrix[i][j].substr(1,5) == "slice")
  1556.          {
  1557.             DrawArt1(i,j);
  1558.          }
  1559.          else if(Matrix[i][j].substr(0,5) != "slide")
  1560.          {
  1561.             _root.attachMovie(Matrix[i][j],slide,_root.getNextHighestDepth());
  1562.             slide._x += Size / 2 - slide._width / 2;
  1563.             slide._y += Size / 2 - slide._height / 2;
  1564.          }
  1565.          else
  1566.          {
  1567.             _root.attachMovie(Matrix[i][j],slide,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
  1568.          }
  1569.          InitSlide(slide);
  1570.       }
  1571.       else
  1572.       {
  1573.          var Lock = Matrix[i][j].substr(0,5);
  1574.          var slid = Matrix[i][j].substr(5,10);
  1575.          _root.attachMovie(slid,slide,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
  1576.          eval(slide).attachMovie(Lock,"l",_root.getNextHighestDepth());
  1577.       }
  1578.       eval(slide)._x = GlobalX + j * Size;
  1579.       eval(slide)._y = GlobalY + i * Size;
  1580.       if(Matrix[i][j].substr(0,5) != "slide")
  1581.       {
  1582.          slide._x += Size / 2 - slide._width / 2;
  1583.          slide._y += Size / 2 - slide._height / 2;
  1584.       }
  1585.    }
  1586.    else
  1587.    {
  1588.       var newname = Matrix[i1][j1];
  1589.       Matrix[i1][j1] = Matrix[i][j];
  1590.       Matrix[i][j] = newname;
  1591.       if(Matrix[i][j].substr(1,5) == "slice")
  1592.       {
  1593.          DrawArt1(i,j);
  1594.       }
  1595.       else if(Matrix[i][j].substr(0,5) != "slide")
  1596.       {
  1597.          _root.attachMovie(Matrix[i][j],slide,_root.getNextHighestDepth());
  1598.       }
  1599.       else
  1600.       {
  1601.          _root.attachMovie(Matrix[i][j],slide,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
  1602.       }
  1603.       InitSlide(slide);
  1604.       if(Matrix[i1][j1].substr(1,5) == "slice")
  1605.       {
  1606.          DrawArt1(i1,j1);
  1607.       }
  1608.       else if(Matrix[i1][j1].substr(0,5) != "slide")
  1609.       {
  1610.          _root.attachMovie(Matrix[i1][j1],slide1,_root.getNextHighestDepth());
  1611.       }
  1612.       else
  1613.       {
  1614.          _root.attachMovie(Matrix[i1][j1],slide1,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
  1615.       }
  1616.       InitSlide(slide1);
  1617.       eval(slide)._x = GlobalX + j * Size;
  1618.       eval(slide)._y = GlobalY + i * Size;
  1619.       eval(slide1)._x = GlobalX + j1 * Size;
  1620.       eval(slide1)._y = GlobalY + i1 * Size;
  1621.       if(Matrix[i][j].substr(1,3) != "sli")
  1622.       {
  1623.          eval(slide)._x += Size / 2 - eval(slide)._width / 2;
  1624.          eval(slide)._y += Size / 2 - eval(slide)._height / 2;
  1625.       }
  1626.       if(Matrix[i1][j1].substr(1,3) != "sli")
  1627.       {
  1628.          eval(slide1)._x += Size / 2 - eval(slide1)._width / 2;
  1629.          eval(slide1)._y += Size / 2 - eval(slide1)._height / 2;
  1630.       }
  1631.       if(chk != "0")
  1632.       {
  1633.          var done = FindChain(Matrix);
  1634.          if(!done)
  1635.          {
  1636.             if(hswap)
  1637.             {
  1638.                hswap = false;
  1639.                clearInterval(HHH);
  1640.                HHH = setInterval(Hints,50,"swap");
  1641.             }
  1642.             if(i > i1)
  1643.             {
  1644.                MoveUp(slide,0);
  1645.             }
  1646.             else if(i1 > i)
  1647.             {
  1648.                MoveUp(slide1,0);
  1649.             }
  1650.             else if(j1 > j)
  1651.             {
  1652.                MoveLeft(slide1,0);
  1653.             }
  1654.             else
  1655.             {
  1656.                MoveLeft(slide,0);
  1657.             }
  1658.          }
  1659.          else
  1660.          {
  1661.             if(SoundOn)
  1662.             {
  1663.                match1_s.start();
  1664.             }
  1665.             Matches++;
  1666.             fallnext = setInterval(function()
  1667.             {
  1668.                clearInterval(fallnext);
  1669.                fall = setInterval(FallDown,Speed,Matrix);
  1670.             }
  1671.             ,100);
  1672.             if(hart)
  1673.             {
  1674.                hart = false;
  1675.                clearInterval(HHH);
  1676.                HHH = setInterval(Hints,50,"art");
  1677.             }
  1678.          }
  1679.       }
  1680.       else
  1681.       {
  1682.          redytoend = true;
  1683.       }
  1684.    }
  1685.    StartHint();
  1686. }
  1687. function StopHint()
  1688. {
  1689.    clearInterval(stopping);
  1690.    sh1.removeMovieClip();
  1691.    sh2.removeMovieClip();
  1692. }
  1693. function GoHint(i1, j1, i2, j2)
  1694. {
  1695.    StopHint();
  1696.    _root.attachMovie("shine","sh1",_root.getNextHighestDepth());
  1697.    _root.attachMovie("shine","sh2",_root.getNextHighestDepth());
  1698.    sh1._x = GlobalX + j1 * Size - 2;
  1699.    sh1._y = GlobalY + i1 * Size - 2;
  1700.    sh2._x = GlobalX + j2 * Size - 2;
  1701.    sh2._y = GlobalY + i2 * Size - 2;
  1702. }
  1703. function CHECK(i, j, i0, j0, i1, j1, i2, j2, chk)
  1704. {
  1705.    var _loc4_ = false;
  1706.    var _loc1_ = Matrix[i][j];
  1707.    if(Matrix[i][j] != "0" && Matrix[i0][j0] != "0" && Matrix[i0][j0] != undefined && Matrix[i0][j0].substr(0,1) != "l" && (Matrix[i1][j1] == _loc1_ || Matrix[i1][j1].substr(5,10) == _loc1_) && (Matrix[i2][j2] == _loc1_ || Matrix[i2][j2].substr(5,10) == _loc1_))
  1708.    {
  1709.       _loc4_ = true;
  1710.       if(chk == undefined)
  1711.       {
  1712.          GoHint(i,j,i0,j0);
  1713.       }
  1714.    }
  1715.    return _loc4_;
  1716. }
  1717. function Finding(i, j, i1, j1)
  1718. {
  1719.    var _loc3_ = false;
  1720.    if(!_loc3_ && (i1 == i && j1 == Number(j) + 1 || i1 == undefined))
  1721.    {
  1722.       _loc3_ = CHECK(Number(i),j,Number(i),Number(j) + 1,Number(i) + 1,Number(j) + 1,Number(i) + 2,Number(j) + 1);
  1723.    }
  1724.    if(!_loc3_ && (i1 == i && j1 == j - 1 || i1 == undefined))
  1725.    {
  1726.       _loc3_ = CHECK(i,Number(j),i,Number(j) - 1,Number(i) + 1,Number(j) - 1,Number(i) + 2,Number(j) - 1);
  1727.    }
  1728.    if(!_loc3_ && (i1 == i && j1 == Number(j) + 1 || i1 == undefined))
  1729.    {
  1730.       _loc3_ = CHECK(i,Number(j),i,Number(j) + 1,i - 1,Number(j) + 1,i - 2,Number(j) + 1);
  1731.    }
  1732.    if(!_loc3_ && (i1 == i && j1 == j - 1 || i1 == undefined))
  1733.    {
  1734.       _loc3_ = CHECK(i,Number(j),i,Number(j) - 1,i - 1,Number(j) - 1,i - 2,Number(j) - 1);
  1735.    }
  1736.    if(!_loc3_ && (i1 == Number(i) + 1 && j1 == j || i1 == undefined))
  1737.    {
  1738.       _loc3_ = CHECK(i,Number(j),Number(i) + 1,Number(j),Number(i) + 1,Number(j) + 1,Number(i) + 1,Number(j) + 2);
  1739.    }
  1740.    if(!_loc3_ && (i1 == Number(i) + 1 && j1 == j || i1 == undefined))
  1741.    {
  1742.       _loc3_ = CHECK(i,Number(j),Number(i) + 1,Number(j),Number(i) + 1,Number(j) - 1,Number(i) + 1,Number(j) - 2);
  1743.    }
  1744.    if(!_loc3_ && (i1 == i - 1 && j1 == j || i1 == undefined))
  1745.    {
  1746.       _loc3_ = CHECK(i,Number(j),i - 1,Number(j),i - 1,Number(j) + 1,i - 1,Number(j) + 2);
  1747.    }
  1748.    if(!_loc3_ && (i1 == i - 1 && j1 == j || i1 == undefined))
  1749.    {
  1750.       _loc3_ = CHECK(i,Number(j),i - 1,Number(j),i - 1,Number(j) - 1,i - 1,Number(j) - 2);
  1751.    }
  1752.    if(!_loc3_ && (i1 == i && j1 == Number(j) + 1 || i1 == undefined))
  1753.    {
  1754.       _loc3_ = CHECK(i,Number(j),i,Number(j) + 1,i - 1,Number(j) + 1,Number(i) + 1,Number(j) + 1);
  1755.    }
  1756.    if(!_loc3_ && (i1 == i && j1 == j - 1 || i1 == undefined))
  1757.    {
  1758.       _loc3_ = CHECK(i,Number(j),i,Number(j) - 1,i - 1,Number(j) - 1,Number(i) + 1,Number(j) - 1);
  1759.    }
  1760.    if(!_loc3_ && (i1 == Number(i) + 1 && j1 == j || i1 == undefined))
  1761.    {
  1762.       _loc3_ = CHECK(i,Number(j),Number(i) + 1,Number(j),Number(i) + 1,Number(j) + 1,Number(i) + 1,Number(j) - 1);
  1763.    }
  1764.    if(!_loc3_ && (i1 == i - 1 && j1 == j || i1 == undefined))
  1765.    {
  1766.       _loc3_ = CHECK(i,Number(j),i - 1,Number(j),i - 1,Number(j) + 1,i - 1,Number(j) - 1);
  1767.    }
  1768.    if(!_loc3_ && (i1 == i - 1 && j1 == j || i1 == undefined))
  1769.    {
  1770.       _loc3_ = CHECK(i,Number(j),i - 1,Number(j),i - 2,Number(j),i - 3,Number(j));
  1771.    }
  1772.    if(!_loc3_ && (i1 == Number(i) + 1 && j1 == j || i1 == undefined))
  1773.    {
  1774.       _loc3_ = CHECK(i,Number(j),Number(i) + 1,Number(j),Number(i) + 2,Number(j),Number(i) + 3,Number(j));
  1775.    }
  1776.    if(!_loc3_ && (i1 == i && j1 == j - 1 || i1 == undefined))
  1777.    {
  1778.       _loc3_ = CHECK(i,Number(j),i,Number(j) - 1,i,Number(j) - 2,i,Number(j) - 3);
  1779.    }
  1780.    if(!_loc3_ && (i1 == i && j1 == Number(j) + 1 || i1 == undefined))
  1781.    {
  1782.       _loc3_ = CHECK(i,Number(j),i,Number(j) + 1,i,Number(j) + 2,i,Number(j) + 3);
  1783.    }
  1784.    return _loc3_;
  1785. }
  1786. function StartHint()
  1787. {
  1788.    clearInterval(stopping);
  1789.    stopping = setInterval(FindStop,7000,Matrix);
  1790. }
  1791. function FindStop(Matrix, chk)
  1792. {
  1793.    if(notBlock)
  1794.    {
  1795.       clearInterval(stopping);
  1796.       var _loc7_ = 0;
  1797.       var _loc6_ = 0;
  1798.       notStop = false;
  1799.       _loc7_ = Math.round(Math.random() * (Matrix.length - 1));
  1800.       _loc6_ = Math.round(Math.random() * (Matrix[0].length - 1));
  1801.       var _loc5_ = 0;
  1802.       while(_loc5_ < Matrix.length)
  1803.       {
  1804.          var _loc2_ = (_loc7_ + _loc5_) % Matrix.length;
  1805.          var _loc1_ = 0;
  1806.          while(_loc1_ < Matrix[_loc2_].length)
  1807.          {
  1808.             var _loc4_ = (_loc6_ + _loc1_) % Matrix[0].length;
  1809.             notStop = Finding(_loc2_,_loc4_);
  1810.             if(notStop)
  1811.             {
  1812.                return _loc2_;
  1813.             }
  1814.             _loc1_ = _loc1_ + 1;
  1815.          }
  1816.          _loc5_ = _loc5_ + 1;
  1817.       }
  1818.       if(!notStop)
  1819.       {
  1820.          GameOver();
  1821.       }
  1822.    }
  1823. }
  1824. function FALL(Name, y0, Y, t0)
  1825. {
  1826.    var time = getTimer();
  1827.    var T = GameSpeed;
  1828.    Name._y = y0 - (time - t0) * (y0 - Y) / T;
  1829.    if(Name._alpha < 100)
  1830.    {
  1831.       Name._alpha = (time - t0) * 100 / T;
  1832.    }
  1833.    if(time > t0 + T)
  1834.    {
  1835.       Name._y = Y;
  1836.       Name._alpha = 100;
  1837.       clearInterval(_root["m" + String(eval(Name))]);
  1838.    }
  1839. }
  1840. function CheckFall()
  1841. {
  1842.    clearInterval(fall);
  1843.    clearInterval(refreshing);
  1844.    Chain++;
  1845.    if(FindChain(Matrix))
  1846.    {
  1847.       if(SoundOn)
  1848.       {
  1849.          match2_s.start();
  1850.       }
  1851.       fall = setInterval(FallDown,200,Matrix);
  1852.    }
  1853.    else if(LastArt())
  1854.    {
  1855.       fall = setInterval(FallDown,200,Matrix);
  1856.    }
  1857.    else
  1858.    {
  1859.       Fall = false;
  1860.       if(Chain > MaxChain)
  1861.       {
  1862.          MaxChain = Chain;
  1863.       }
  1864.       Chain = 0;
  1865.       notBlock = true;
  1866.       redytoend = true;
  1867.       StartHint();
  1868.    }
  1869. }
  1870. function LastArt()
  1871. {
  1872.    var _loc2_ = false;
  1873.    j = 0;
  1874.    while(j < Matrix[0].length)
  1875.    {
  1876.       var _loc1_ = Matrix.length - 1;
  1877.       temp = Matrix[_loc1_][j];
  1878.       while(temp == "0")
  1879.       {
  1880.          _loc1_ = _loc1_ - 1;
  1881.          temp = Matrix[_loc1_][j];
  1882.       }
  1883.       if(temp.substr(1,5) == "slice" || temp == "lamp" || temp == "hammer" || temp == "watch" || temp == "digger")
  1884.       {
  1885.          _loc2_ = true;
  1886.       }
  1887.       j++;
  1888.    }
  1889.    return _loc2_;
  1890. }
  1891. function FallDown(Matrix)
  1892. {
  1893.    function FallColomn(j)
  1894.    {
  1895.       var N = 0;
  1896.       var i = Matrix.length - 1;
  1897.       while(i >= 0)
  1898.       {
  1899.          if(Matrix[i][j] != "0")
  1900.          {
  1901.             if(Matrix[i][j] == "no")
  1902.             {
  1903.                N++;
  1904.             }
  1905.             else if((Matrix[i][j].substr(1,5) == "slice" || Matrix[i][j] == "hammer" || Matrix[i][j] == "digger" || Matrix[i][j] == "watch" || Matrix[i][j] == "lamp") && (Matrix[i + 1][j] == undefined || Matrix[i + 1][j] == "0"))
  1906.             {
  1907.                Falling = true;
  1908.                N++;
  1909.                var temp = Matrix[i][j];
  1910.                MoveArt(i,j,temp);
  1911.                Matrix[i][j] = "no";
  1912.             }
  1913.             else if(N)
  1914.             {
  1915.                var slide = FindName(i,j);
  1916.                var X = eval(slide)._x;
  1917.                var Y = eval(slide)._y;
  1918.                var Name = Matrix[i][j];
  1919.                eval(slide).removeMovieClip();
  1920.                var k = i + N;
  1921.                slide = "s" + k + j;
  1922.                if(Name.substr(0,4) != "lock")
  1923.                {
  1924.                   if(Name.substr(1,5) == "slice")
  1925.                   {
  1926.                      _root.createEmptyMovieClip(slide,_root.getNextHighestDepth());
  1927.                      eval(slide).attachMovie(Name,"mask",eval(slide).getNextHighestDepth());
  1928.                      eval(slide).attachMovie("art","art",eval(slide).getNextHighestDepth());
  1929.                      eval(slide).art._width = eval(slide).mask._width;
  1930.                      eval(slide).art._height = eval(slide).mask._height;
  1931.                      if(eval(slide).art._width < Size / 2)
  1932.                      {
  1933.                         eval(slide).art._width = Size * 2 / 3;
  1934.                      }
  1935.                      eval(slide).art._x = eval(slide).mask._x = Size / 2 - eval(slide).art._width / 2;
  1936.                      eval(slide).art._y = eval(slide).mask._y = Size / 2 - eval(slide).art._height / 2;
  1937.                      eval(slide)._x = X;
  1938.                      eval(slide)._y = Y;
  1939.                   }
  1940.                   else if(Name.substr(0,5) != "slide")
  1941.                   {
  1942.                      _root.attachMovie(Name,slide,_root.getNextHighestDepth(),{_x:X,_y:Y});
  1943.                   }
  1944.                   else
  1945.                   {
  1946.                      _root.attachMovie(Name,slide,_root.getNextHighestDepth(),{_x:X,_y:Y,_width:Size1,_height:Size1});
  1947.                   }
  1948.                   InitSlide(slide);
  1949.                }
  1950.                else
  1951.                {
  1952.                   var Lock = Name.substr(0,5);
  1953.                   var slid = Name.substr(5,10);
  1954.                   _root.attachMovie(slid,slide,_root.getNextHighestDepth(),{_x:X,_y:Y,_width:Size1,_height:Size1});
  1955.                   eval(slide).attachMovie(Lock,"l",_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
  1956.                }
  1957.                Matrix[k][j] = Matrix[i][j];
  1958.                Matrix[i][j] = "no";
  1959.                clearInterval(_root["m" + String(eval(slide))]);
  1960.                _root["m" + String(eval(slide))] = setInterval(FALL,0,eval(slide),Y,Y + N * Size,getTimer());
  1961.             }
  1962.          }
  1963.          i--;
  1964.       }
  1965.       var l = 0;
  1966.       while(Matrix[l][j] == "0")
  1967.       {
  1968.          l++;
  1969.       }
  1970.       i = 0;
  1971.       while(i < N)
  1972.       {
  1973.          k = i + l;
  1974.          var Name = "slide" + Math.round(Math.random() * (Nomer - 1) + 1);
  1975.          Matrix[k][j] = Name;
  1976.          var X = GlobalX + j * Size;
  1977.          var Y = GlobalY - (N - k) * Size;
  1978.          _root.attachMovie(Name,"s" + k + j,_root.getNextHighestDepth(),{_x:X,_y:Y,_alpha:0,_width:Size1,_height:Size1});
  1979.          eval("s" + k + j)._x += Size / 2 - eval("s" + k + j)._width / 2;
  1980.          Name = "s" + k + j;
  1981.          clearInterval(_root["m" + String(eval(Name))]);
  1982.          InitSlide(Name);
  1983.          _root["m" + String(eval(Name))] = setInterval(FALL,0,eval(Name),Y,Y + N * Size + Size / 2 - eval(Name)._height / 2,getTimer());
  1984.          i++;
  1985.       }
  1986.    }
  1987.    clearInterval(fall);
  1988.    notBlock = false;
  1989.    clearInterval(refreshing);
  1990.    refreshing = setInterval(function()
  1991.    {
  1992.       updateAfterEvent();
  1993.    }
  1994.    ,0);
  1995.    Fall = true;
  1996.    StopHint();
  1997.    var j = 0;
  1998.    while(j < Matrix[0].length)
  1999.    {
  2000.       FallColomn(j);
  2001.       j++;
  2002.    }
  2003.    fall = setInterval(CheckFall,GameSpeed + 50);
  2004. }
  2005. function MoveArt(i, j, Name)
  2006. {
  2007.    var temp = Name;
  2008.    if(Name == "hammer" && Hammer)
  2009.    {
  2010.       Name = "a" + Name;
  2011.    }
  2012.    else if(Name == "digger" && Digger)
  2013.    {
  2014.       Name = "a" + Name;
  2015.    }
  2016.    else if(Name == "watch" && Watch)
  2017.    {
  2018.       Name = "a" + Name;
  2019.    }
  2020.    else if(Name == "lamp" && Lamp)
  2021.    {
  2022.       Name = "a" + Name;
  2023.    }
  2024.    moveart = true;
  2025.    var End = GlobalY + (i + 2.5) * Size;
  2026.    var slide = FindName(i,j);
  2027.    _root.attachMovie(temp,Name,_root.getNextHighestDepth());
  2028.    eval(Name)._x = eval(slide)._x + 15 - eval(slide)._width / 2;
  2029.    eval(Name)._y = eval(slide)._y + 15 - eval(slide)._height / 2;
  2030.    eval(slide).removeMovieClip();
  2031.    if(Name.substr(1,5) == "slice")
  2032.    {
  2033.       var EndX = ArtPos[Number(Name.substr(6,2))].x;
  2034.       var EndY = ArtPos[Number(Name.substr(6,2))].y;
  2035.    }
  2036.    else if(temp == "hammer")
  2037.    {
  2038.       var EndX = HamX;
  2039.       var EndY = HamY;
  2040.       Hammer++;
  2041.       hmove = setInterval(function()
  2042.       {
  2043.          clearInterval(hmove);
  2044.          TextShow(hamn,"x" + Hammer,"h",0,0,0);
  2045.          eval(Name).onPress = onHammerClick;
  2046.       }
  2047.       ,bonus_s.duration - 1100);
  2048.    }
  2049.    else if(temp == "digger")
  2050.    {
  2051.       Digger++;
  2052.       var EndX = DigX;
  2053.       var EndY = DigY;
  2054.       dmove = setInterval(function()
  2055.       {
  2056.          clearInterval(dmove);
  2057.          TextShow(dign,"x" + Digger,"h",0,0,0);
  2058.          eval(Name).onPress = onDiggerClick;
  2059.       }
  2060.       ,bonus_s.duration - 1100);
  2061.    }
  2062.    else if(temp == "watch")
  2063.    {
  2064.       Watch++;
  2065.       var EndX = WatX;
  2066.       var EndY = WatY;
  2067.       wmove = setInterval(function()
  2068.       {
  2069.          clearInterval(wmove);
  2070.          TextShow(watn,"x" + Watch,"h",0,0,0);
  2071.          eval(Name).onPress = onWatchClick;
  2072.       }
  2073.       ,bonus_s.duration - 1100);
  2074.    }
  2075.    else if(temp == "lamp")
  2076.    {
  2077.       Lamp++;
  2078.       var EndX = LamX;
  2079.       var EndY = LamY;
  2080.       lmove = setInterval(function()
  2081.       {
  2082.          clearInterval(lmove);
  2083.          TextShow(lamn,"x" + Lamp,"h",0,0,0);
  2084.          eval(Name).onPress = onLampClick;
  2085.       }
  2086.       ,bonus_s.duration - 1100);
  2087.    }
  2088.    var a;
  2089.    var b;
  2090.    var c;
  2091.    var x1;
  2092.    var x2;
  2093.    var x3;
  2094.    var y1;
  2095.    var y2;
  2096.    var y3 = 0;
  2097.    x3 = EndX - 3;
  2098.    y3 = EndY - 3;
  2099.    x2 = eval(Name)._x;
  2100.    y2 = eval(Name)._y;
  2101.    if(x2 < 400)
  2102.    {
  2103.       x1 = 200;
  2104.    }
  2105.    else
  2106.    {
  2107.       x1 = 270;
  2108.    }
  2109.    y1 = 300;
  2110.    a = ((y2 - y1) / (x2 - x1) - (y3 - y1) / (x3 - x1)) / (x2 - x3);
  2111.    b = (y2 - y1) / (x2 - x1) - a * (x2 + x1);
  2112.    c = y1 - a * x1 * x1 - b * x1;
  2113.    if(temp.substr(1,5) == "slice")
  2114.    {
  2115.       if(SoundOn)
  2116.       {
  2117.          art_s.start();
  2118.          watch_s.start();
  2119.       }
  2120.       snd = 2900;
  2121.    }
  2122.    else
  2123.    {
  2124.       snd = bonus_s.duration - 1100;
  2125.       if(SoundOn)
  2126.       {
  2127.          bonus_s.start();
  2128.       }
  2129.    }
  2130.    var i = 10;
  2131.    _root["TAIL" + Name] = setInterval(function()
  2132.    {
  2133.       if(i < NumTail)
  2134.       {
  2135.          _root.attachMovie("tail","tail" + i + Name,_root.getNextHighestDepth(),{_x:eval(Name)._x + Math.random() * 20,_y:eval(Name)._y + Math.random() * 20});
  2136.          i++;
  2137.       }
  2138.       else
  2139.       {
  2140.          clearInterval(_root["TAIL" + Name]);
  2141.       }
  2142.    }
  2143.    ,TailPeriod);
  2144.    AddingTime = 0;
  2145.    clearInterval(AddT);
  2146.    AddT = setInterval(AddTime,50,snd / 20);
  2147.    _root[MATP + Name] = setInterval(MoveArtToPosition,Speed,Name,temp,x3,y3,a,b,c,getTimer(),x2,snd);
  2148. }
  2149. function MoveArtToPosition(Name, temp, EndX, EndY, a, b, c, Time, x2, snd)
  2150. {
  2151.    moveart = true;
  2152.    var Done = false;
  2153.    var Time1 = getTimer();
  2154.    if(Time1 - Time >= snd)
  2155.    {
  2156.       Done = true;
  2157.    }
  2158.    else
  2159.    {
  2160.       var l = x2 - (Time1 - Time) * (x2 - EndX) / snd;
  2161.       var m = l;
  2162.       eval(Name)._x = l;
  2163.       eval(Name)._y = a * l * l + b * l + c;
  2164.    }
  2165.    if(Done)
  2166.    {
  2167.       clearInterval(_root[MATP + Name]);
  2168.       clearInterval(_root["aaa" + Name]);
  2169.       _root["aaa" + Name] = setInterval(function()
  2170.       {
  2171.          var i = 10;
  2172.          while(i < NumTail)
  2173.          {
  2174.             eval("tail" + i + Name).removeMovieClip();
  2175.             i++;
  2176.          }
  2177.          clearInterval(_root["aaa" + Name]);
  2178.          clearInterval(TAIL);
  2179.          eval(Name)._x = EndX + 3;
  2180.          eval(Name)._y = EndY + 3;
  2181.          moveart = false;
  2182.          eval("a" + temp).removeMovieClip();
  2183.          eval(Name).fon.removeMovieClip();
  2184.          ArtPos[Number(Name.substr(6,2))].is = true;
  2185.          CheckEnd(Matrix);
  2186.          if(_root["h" + temp + "2"])
  2187.          {
  2188.             _root["h" + temp + "2"] = false;
  2189.             clearInterval(HHH);
  2190.             HHH = setInterval(Hints,50,temp + "2");
  2191.          }
  2192.       }
  2193.       ,300);
  2194.    }
  2195.    updateAfterEvent();
  2196. }
  2197. function CheckEnd(Matrix)
  2198. {
  2199.    var _loc4_ = true;
  2200.    var _loc2_ = 0;
  2201.    while(_loc2_ < Matrix.length)
  2202.    {
  2203.       var _loc1_ = 0;
  2204.       while(_loc1_ < Matrix[_loc2_].length)
  2205.       {
  2206.          if(Matrix[_loc2_][_loc1_].substr(1,5) == "slice")
  2207.          {
  2208.             _loc4_ = false;
  2209.             break;
  2210.          }
  2211.          _loc1_ = _loc1_ + 1;
  2212.       }
  2213.       _loc2_ = _loc2_ + 1;
  2214.    }
  2215.    if(_loc4_)
  2216.    {
  2217.       clearInterval(ER);
  2218.       ER = setInterval(EndRound,20,Matrix);
  2219.    }
  2220.    else if(hart2)
  2221.    {
  2222.       hart2 = false;
  2223.       clearInterval(HHH);
  2224.       HHH = setInterval(Hints,50,"art2");
  2225.    }
  2226. }
  2227. function EndRound(Matrix)
  2228. {
  2229.    if(moveart && !notBlock)
  2230.    {
  2231.       clearInterval(ER);
  2232.    }
  2233.    else if(redytoend && notBlock && !moveart)
  2234.    {
  2235.       notBlock = false;
  2236.       clearInterval(ER);
  2237.       RoundSity++;
  2238.       if(RoundSity == 9 || RoundCountry == 1 && RoundSity == 8 || RoundCountry == 0 && RoundSity == 6)
  2239.       {
  2240.          RoundSity = 0;
  2241.       }
  2242.       FromHint();
  2243.       StopTimer();
  2244.       bl.removeMovieClip();
  2245.       inMenu = false;
  2246.       mainmenu.removeMovieClip();
  2247.       EEE = getTimer();
  2248.       EndTime = Math.abs(Math.round((EndTime - EEE) / 1000));
  2249.       TimeBonus = 0;
  2250.       endstring = Matrix.length;
  2251.       bl.removeMovieClip();
  2252.       _root.attachMovie("black","bl",_root.getNextHighestDepth());
  2253.       bl._width = 520;
  2254.       bl._height = 390;
  2255.       bl._alpha = 0;
  2256.       bl.useHandCursor = false;
  2257.       bl.onPress = function()
  2258.       {
  2259.          clearInterval(endinground);
  2260.          endinground = setInterval(function()
  2261.          {
  2262.             clearInterval(endinground);
  2263.             var i = 0;
  2264.             while(i < Matrix.length)
  2265.             {
  2266.                var j = 0;
  2267.                while(j < Matrix[0].length)
  2268.                {
  2269.                   eval("s" + i + j).removeMovieClip();
  2270.                   j++;
  2271.                }
  2272.                i++;
  2273.             }
  2274.             clearInterval(ending);
  2275.             bigtext.removeMovieClip();
  2276.             endstring = 0;
  2277.             TIME.time1._x = -270;
  2278.             score += EndTime * 10 + Add;
  2279.             TextShow(SCORE,String(score),"sc",0,0,1);
  2280.             if(score >= NextLife)
  2281.             {
  2282.                Life++;
  2283.                if(SoundOn)
  2284.                {
  2285.                   life_s.start();
  2286.                }
  2287.                NextLife += 35000;
  2288.             }
  2289.             TimeBonus += Add + EndTime * 10;
  2290.             Add = 0;
  2291.             ShowStats();
  2292.          }
  2293.          ,800);
  2294.       };
  2295.       clearInterval(ending);
  2296.       var str = normal;
  2297.       if(EndTime >= 4 * totaltime / 5000)
  2298.       {
  2299.          str = fast;
  2300.       }
  2301.       else if(EndTime <= totaltime / 5000)
  2302.       {
  2303.          str = slow;
  2304.       }
  2305.       if(RoundSity == 100)
  2306.       {
  2307.          str = textgameover;
  2308.       }
  2309.       bigtext.removeMovieClip();
  2310.       _root.attachMovie("bigtext","bigtext",_root.getNextHighestDepth(),{_x:360,_y:180});
  2311.       TextShow(bigtext,str,"t",5,20,1);
  2312.       ending = setInterval(Ending,200,"r");
  2313.    }
  2314. }
  2315. function Ending(chk)
  2316. {
  2317.    notBlock = false;
  2318.    if(chk == "r")
  2319.    {
  2320.       endstring--;
  2321.       if(endstring == -1)
  2322.       {
  2323.          clearInterval(ending);
  2324.          if(SoundOn)
  2325.          {
  2326.             time_s.start();
  2327.          }
  2328.          ending = setInterval(Ending,0);
  2329.       }
  2330.       else
  2331.       {
  2332.          if(SoundOn && endstring > 0)
  2333.          {
  2334.             endexplode_s.start();
  2335.          }
  2336.          var j = 0;
  2337.          while(j < Matrix[0].length)
  2338.          {
  2339.             if(eval("s" + endstring + j) != undefined)
  2340.             {
  2341.                _root.attachMovie("blow","s" + endstring + j,_root.getNextHighestDepth(),{_x:GlobalX + Size * j - 2,_y:GlobalY + Size * endstring - 2});
  2342.             }
  2343.             eval("s" + endstring + j).removeMovieClip();
  2344.             eval("s" + endstring + j + "fon").gotoAndStop(1);
  2345.             j++;
  2346.          }
  2347.       }
  2348.    }
  2349.    else if(EndTime <= 0)
  2350.    {
  2351.       clearInterval(ending);
  2352.       bigtext.removeMovieClip();
  2353.       time_s.stop();
  2354.       clearInterval(endinground);
  2355.       stats1 = setInterval(ShowStats,100);
  2356.    }
  2357.    else
  2358.    {
  2359.       EndTime -= 2;
  2360.       var temp = 100 * (EndTime * 1000) / totaltime;
  2361.       TIME.time1._x = (temp - 100) * 270 / 100;
  2362.       TimeBonus += 20;
  2363.       if(SoundOn)
  2364.       {
  2365.          scores_s.start();
  2366.       }
  2367.       Score(20,"y");
  2368.    }
  2369.    updateAfterEvent();
  2370. }
  2371. function ShowStats()
  2372. {
  2373.    if(Add == 0)
  2374.    {
  2375.       if(SoundOn)
  2376.       {
  2377.          stats_s.start();
  2378.       }
  2379.       bl.removeMovieClip();
  2380.       clearInterval(stats1);
  2381.       stats.removeMovieClip();
  2382.       _root.attachMovie("black","bl",_root.getNextHighestDepth());
  2383.       _root.attachMovie("statspanel","stats",_root.getNextHighestDepth());
  2384.       bl._alpha = 50;
  2385.       bl._width = 520;
  2386.       bl._height = 390;
  2387.       stats._x = 200;
  2388.       stats._y = 100;
  2389.       bl.onPress = AAA;
  2390.       bl.useHandCursor = false;
  2391.       TextShow(stats.txt01,texttiles,"h",0,0,0);
  2392.       TextShow(stats.txt02,textmatches,"h",0,0,0);
  2393.       TextShow(stats.txt03,textchain,"h",0,0,0);
  2394.       TextShow(stats.txt04,texttime,"h",0,0,0);
  2395.       TextShow(stats.txt05,textbonus,"h",0,0,0);
  2396.       TextShow(stats.txt06,textscore,"h",0,0,0);
  2397.       TextShow(stats.txt1,String(Tiles),"h",-1,0,2);
  2398.       TextShow(stats.txt2,String(Matches),"h",-1,0,2);
  2399.       TextShow(stats.txt3,String(MaxChain),"h",-1,0,2);
  2400.       TextShow(stats.txt4,String(Math.round((EEE - BeginTime) / 1000) + textseconds),"h",-1,0,2);
  2401.       TextShow(stats.txt5,String(TimeBonus),"h",-1,0,2);
  2402.       TextShow(stats.txt6,String(score),"h",-1,0,2);
  2403.    }
  2404. }
  2405. function ShowNag()
  2406. {
  2407.    ClearRound(Matrix);
  2408.    if(RoundSity == 100)
  2409.    {
  2410.       _root.attachMovie("nag","nag",_root.getNextHighestDepth());
  2411.    }
  2412.    else if(nagtime == 0 && RoundSity == 0)
  2413.    {
  2414.       _root.attachMovie("endscreen","screen",_root.getNextHighestDepth());
  2415.    }
  2416.    else if(nagtime && RoundSity % nagtime == 0)
  2417.    {
  2418.       RedyToPlay = false;
  2419.       _root.attachMovie("nag","nag",_root.getNextHighestDepth());
  2420.       Start = setInterval(function()
  2421.       {
  2422.          if(RedyToPlay)
  2423.          {
  2424.             clearInterval(Start);
  2425.             if(RoundSity != 0)
  2426.             {
  2427.                InitRound();
  2428.             }
  2429.             else
  2430.             {
  2431.                _root.attachMovie("endscreen","screen",_root.getNextHighestDepth());
  2432.             }
  2433.          }
  2434.       }
  2435.       ,50);
  2436.    }
  2437.    else
  2438.    {
  2439.       InitRound();
  2440.    }
  2441. }
  2442. function MoveUp(slide, chk)
  2443. {
  2444.    var i = FindIndexX(String(slide));
  2445.    var j = FindIndexY(String(slide));
  2446.    i--;
  2447.    if(Matrix[i][j] != "0" && Matrix[i][j] != undefined && Matrix[i][j].substr(0,4) != "lock")
  2448.    {
  2449.       slide1 = FindName(i,j);
  2450.       _root["m" + String(eval(slide))] = setInterval(MovingUp,Speed,eval(slide),eval(slide)._y,chk);
  2451.       _root["m" + String(eval(slide1))] = setInterval(MovingDown,Speed,eval(slide1),eval(slide1)._y,chk);
  2452.    }
  2453.    else
  2454.    {
  2455.       notBlock = true;
  2456.    }
  2457. }
  2458. function MoveDown(slide, chk)
  2459. {
  2460.    var i = FindIndexX(String(slide));
  2461.    var j = FindIndexY(String(slide));
  2462.    i++;
  2463.    if(Matrix[i][j] != "0" && Matrix[i][j] != undefined && Matrix[i][j].substr(0,4) != "lock")
  2464.    {
  2465.       slide1 = FindName(i,j);
  2466.       _root["m" + String(eval(slide))] = setInterval(MovingDown,Speed,eval(slide),eval(slide)._y,chk);
  2467.       _root["m" + String(eval(slide1))] = setInterval(MovingUp,Speed,eval(slide1),eval(slide1)._y,chk);
  2468.    }
  2469.    else
  2470.    {
  2471.       notBlock = true;
  2472.    }
  2473. }
  2474. function MoveLeft(slide, chk)
  2475. {
  2476.    var i = FindIndexX(String(slide));
  2477.    var j = FindIndexY(String(slide));
  2478.    j--;
  2479.    if(Matrix[i][j] != "0" && Matrix[i][j] != undefined && Matrix[i][j].substr(0,4) != "lock")
  2480.    {
  2481.       slide1 = FindName(i,j);
  2482.       _root["m" + String(eval(slide))] = setInterval(MovingLeft,Speed,eval(slide),eval(slide)._x,chk);
  2483.       _root["m" + String(eval(slide1))] = setInterval(MovingRight,Speed,eval(slide1),eval(slide1)._x,chk);
  2484.    }
  2485.    else
  2486.    {
  2487.       notBlock = true;
  2488.    }
  2489. }
  2490. function MoveRight(slide, chk)
  2491. {
  2492.    var i = FindIndexX(String(slide));
  2493.    var j = FindIndexY(String(slide));
  2494.    j++;
  2495.    if(Matrix[i][j] != "0" && Matrix[i][j] != undefined && Matrix[i][j].substr(0,4) != "lock")
  2496.    {
  2497.       slide1 = FindName(i,j);
  2498.       _root["m" + String(eval(slide))] = setInterval(MovingRight,Speed,eval(slide),eval(slide)._x,chk);
  2499.       _root["m" + String(eval(slide1))] = setInterval(MovingLeft,Speed,eval(slide1),eval(slide1)._x,chk);
  2500.    }
  2501.    else
  2502.    {
  2503.       notBlock = true;
  2504.    }
  2505. }
  2506. function Follow()
  2507. {
  2508.    this._x = _root._xmouse - 20;
  2509.    this._y = _root._ymouse - 5;
  2510.    Mouse.hide();
  2511.    updateAfterEvent();
  2512. }
  2513. function onHammerClick()
  2514. {
  2515.    if(!moveart && notBlock)
  2516.    {
  2517.       if(!hammeruse)
  2518.       {
  2519.          hammeruse = true;
  2520.          Hammer--;
  2521.          hammer._alpha = 50;
  2522.          notBlock = false;
  2523.          Mouse.hide();
  2524.          _root.attachMovie("hammer","ham",_root.getNextHighestDepth());
  2525.          ham._x = HamX;
  2526.          ham._y = HamY;
  2527.          ham.onMouseMove = Follow;
  2528.       }
  2529.    }
  2530.    else if(hammeruse)
  2531.    {
  2532.       hammer._alpha = 100;
  2533.       ham.removeMovieClip();
  2534.       Hammer++;
  2535.       hammeruse = false;
  2536.       Mouse.show();
  2537.       notBlock = true;
  2538.    }
  2539. }
  2540. function onDiggerClick()
  2541. {
  2542.    if(notBlock && !moveart)
  2543.    {
  2544.       notBlock = false;
  2545.       if(SoundOn)
  2546.       {
  2547.          digger_s.start();
  2548.       }
  2549.       Digger--;
  2550.       TextShow(dign,"x" + Digger,"h",0,0,0);
  2551.       if(!Digger)
  2552.       {
  2553.          digger.removeMovieClip();
  2554.          dign.TEXT.removeMovieClip();
  2555.       }
  2556.       var i = 0;
  2557.       while(i < Matrix.length)
  2558.       {
  2559.          var j = 0;
  2560.          while(j < Matrix[i].length)
  2561.          {
  2562.             if(Matrix[i][j].substr(1,5) == "slice" && (Matrix[i + 1][j].substr(0,1) == "s" || Matrix[i + 1][j].substr(5,1) == "s"))
  2563.             {
  2564.                var Name = FindName(i + 1,j);
  2565.                _root.attachMovie("lopata","l" + Name,_root.getNextHighestDepth(),{_x:GlobalX + j * Size,_y:GlobalY + (i + 1) * Size});
  2566.                eval(Name).setMask("l" + Name);
  2567.                Matrix[i + 1][j] = "no";
  2568.             }
  2569.             j++;
  2570.          }
  2571.          i++;
  2572.       }
  2573.    }
  2574. }
  2575. function onWatchClick()
  2576. {
  2577.    if(notBlock && !moveart)
  2578.    {
  2579.       if(SoundOn)
  2580.       {
  2581.          watch_s.start();
  2582.       }
  2583.       Watch--;
  2584.       TextShow(watn,"x" + Watch,"h",0,0,0);
  2585.       if(!Watch)
  2586.       {
  2587.          watch.removeMovieClip();
  2588.          watn.TEXT.removeMovieClip();
  2589.       }
  2590.       var eend = EndTime;
  2591.       AddingTime = 0;
  2592.       eend += totaltime / 5;
  2593.       if(eend > totaltime + getTimer())
  2594.       {
  2595.          eend = totaltime + getTimer();
  2596.       }
  2597.       clearInterval(AddT);
  2598.       AddT = setInterval(AddTime,50,(eend - EndTime) / 20);
  2599.    }
  2600. }
  2601. function AddTime(times)
  2602. {
  2603.    AddingTime++;
  2604.    EndTime += times;
  2605.    Timing();
  2606.    if(AddingTime == 20)
  2607.    {
  2608.       clearInterval(AddT);
  2609.    }
  2610.    updateAfterEvent();
  2611. }
  2612. function onLampClick()
  2613. {
  2614.    function ATTACH(i, j)
  2615.    {
  2616.       if(Matrix[i][j].substr(0,5) == "slide")
  2617.       {
  2618.          var temp1 = Math.round(Math.random() * (Nomer - 1)) + 1;
  2619.          var temp = "slide" + temp1;
  2620.          Matrix[i][j] = temp;
  2621.          var temp3 = FindName(i,j);
  2622.          eval(temp3).removeMovieClip();
  2623.          _root.attachMovie(temp,temp3,_root.getNextHighestDepth(),{_width:Size,_height:Size});
  2624.          var ttt = Math.round(Math.random() * 1000);
  2625.          _root.attachMovie("lampb","l" + ttt,_root.getNextHighestDepth(),{_width:Size,_height:Size});
  2626.          eval(temp3)._x = GlobalX + j * Size;
  2627.          eval(temp3)._y = GlobalY + i * Size;
  2628.          InitSlide(temp3);
  2629.          eval("l" + ttt)._x = GlobalX + j * Size - 2;
  2630.          eval("l" + ttt)._y = GlobalY + i * Size - 2;
  2631.       }
  2632.    }
  2633.    if(notBlock && !moveart)
  2634.    {
  2635.       if(SoundOn)
  2636.       {
  2637.          lamp_s.start();
  2638.       }
  2639.       notBlock = false;
  2640.       Lamp--;
  2641.       TextShow(lamn,"x" + Lamp,"h",0,0,0);
  2642.       if(!Lamp)
  2643.       {
  2644.          lamp.removeMovieClip();
  2645.          lamn.TEXT.removeMovieClip();
  2646.       }
  2647.       var i = 0;
  2648.       while(i < Matrix.length)
  2649.       {
  2650.          var j = 0;
  2651.          while(j < Matrix[i].length)
  2652.          {
  2653.             if(Matrix[i][j].substr(1,5) == "slice")
  2654.             {
  2655.                ATTACH(i - 1,j - 1);
  2656.                ATTACH(i - 1,j + 1);
  2657.                ATTACH(i + 1,j - 1);
  2658.                ATTACH(i + 1,j + 1);
  2659.                ATTACH(i - 1,j);
  2660.                ATTACH(i,j - 1);
  2661.                ATTACH(i + 1,j);
  2662.                ATTACH(i,j + 1);
  2663.             }
  2664.             j++;
  2665.          }
  2666.          i++;
  2667.       }
  2668.    }
  2669. }
  2670. function DragSlide(x, x1, y, y1, slide)
  2671. {
  2672.    notBlock = false;
  2673.    var _loc1_ = String(slide);
  2674.    if(x > x1 + Step && Math.abs(x - x1) >= Math.abs(y - y1))
  2675.    {
  2676.       CheckSuccess(FindIndexX(_loc1_),FindIndexY(_loc1_),FindIndexX(_loc1_),FindIndexY(_loc1_) - 1);
  2677.       MoveLeft(slide);
  2678.    }
  2679.    else if(x + Step < x1 && Math.abs(x - x1) >= Math.abs(y - y1))
  2680.    {
  2681.       CheckSuccess(FindIndexX(_loc1_),FindIndexY(_loc1_),FindIndexX(_loc1_),Number(FindIndexY(_loc1_)) + 1);
  2682.       MoveRight(slide);
  2683.    }
  2684.    else if(y + Step < y1 && Math.abs(x - x1) < Math.abs(y - y1))
  2685.    {
  2686.       CheckSuccess(FindIndexX(_loc1_),FindIndexY(_loc1_),Number(FindIndexX(_loc1_)) + 1,FindIndexY(_loc1_));
  2687.       MoveDown(slide);
  2688.    }
  2689.    else if(y > y1 + Step && Math.abs(x - x1) < Math.abs(y - y1))
  2690.    {
  2691.       CheckSuccess(FindIndexX(_loc1_),FindIndexY(_loc1_),FindIndexX(_loc1_) - 1,FindIndexY(_loc1_));
  2692.       MoveUp(slide);
  2693.    }
  2694.    else
  2695.    {
  2696.       notBlock = true;
  2697.    }
  2698. }
  2699. function OverMove()
  2700. {
  2701.    if(notBlock || hammeruse)
  2702.    {
  2703.       if(Blink != this)
  2704.       {
  2705.          eval(this + "fon").gotoAndStop(2);
  2706.       }
  2707.    }
  2708. }
  2709. function OutMove()
  2710. {
  2711.    if(notBlock || hammeruse)
  2712.    {
  2713.       if(Blink != this)
  2714.       {
  2715.          eval(this + "fon").gotoAndStop(1);
  2716.       }
  2717.    }
  2718. }
  2719. function Press()
  2720. {
  2721.    if(notBlock)
  2722.    {
  2723.       StartTimer();
  2724.       if(SoundOn)
  2725.       {
  2726.          click_s.start();
  2727.       }
  2728.       if(CheckClick(this))
  2729.       {
  2730.          eval(Blink + "fon").gotoAndStop(1);
  2731.          eval(this + "fon").gotoAndStop(3);
  2732.          Blink = this;
  2733.       }
  2734.       x = _root._xmouse;
  2735.       y = _root._ymouse;
  2736.       var temp = String(this);
  2737.       oMouse = {};
  2738.       oMouse.onMouseMove = function()
  2739.       {
  2740.          Dragging(temp);
  2741.       };
  2742.       Mouse.addListener(oMouse);
  2743.       value = this;
  2744.    }
  2745.    if(hammeruse)
  2746.    {
  2747.       var i = FindIndexX(String(this));
  2748.       var j = FindIndexY(String(this));
  2749.       if(Matrix[i][j].substr(0,5) == "slide" || Matrix[i][j].substr(5,5) == "slide")
  2750.       {
  2751.          if(SoundOn)
  2752.          {
  2753.             hammer_s.start();
  2754.          }
  2755.          Blow(i,j);
  2756.          ham.removeMovieClip();
  2757.          if(!Hammer)
  2758.          {
  2759.             hammer.removeMovieClip();
  2760.             hamn.TEXT.removeMovieClip();
  2761.          }
  2762.          else
  2763.          {
  2764.             hammer._alpha = 100;
  2765.             TextShow(hamn,"x" + Hammer,"h",0,0,0);
  2766.          }
  2767.          fall = setInterval(function()
  2768.          {
  2769.             hammeruse = false;
  2770.             Mouse.show();
  2771.             var i = 0;
  2772.             while(i < Matrix.length)
  2773.             {
  2774.                var j = 0;
  2775.                while(j < Matrix[0].length)
  2776.                {
  2777.                   eval("s" + i + j + "fon").gotoAndStop(1);
  2778.                   j++;
  2779.                }
  2780.                i++;
  2781.             }
  2782.             FallDown(Matrix);
  2783.          }
  2784.          ,500);
  2785.       }
  2786.    }
  2787. }
  2788. function Dragging(str)
  2789. {
  2790.    var x1 = _root._xmouse;
  2791.    var y1 = _root._ymouse;
  2792.    if(Math.abs(x - x1) > 10 || Math.abs(y - y1) > 10)
  2793.    {
  2794.       Mouse.removeListener(oMouse);
  2795.       if(notBlock)
  2796.       {
  2797.          DragSlide(x,x1,y,y1,eval(str));
  2798.       }
  2799.    }
  2800. }
  2801. function Release()
  2802. {
  2803.    Mouse.removeListener(oMouse);
  2804. }
  2805. function FromHint()
  2806. {
  2807.    hints.removeMovieClip();
  2808.    HH.removeMovieClip();
  2809.    buttonhelp.removeMovieClip();
  2810.    hints.removeMovieClip();
  2811.    Mouse.removeListener(ooMouse);
  2812.    StartHint();
  2813.    StartTimer();
  2814. }
  2815. function GoHints(x, y)
  2816. {
  2817.    _root.attachMovie("hints","hints",_root.getNextHighestDepth(),{_x:x,_y:y});
  2818. }
  2819. function Hints(hint)
  2820. {
  2821.    function FindSlide(slide)
  2822.    {
  2823.       var _loc2_ = 0;
  2824.       while(_loc2_ < Matrix.length)
  2825.       {
  2826.          var _loc1_ = 0;
  2827.          while(_loc1_ < Matrix[_loc2_].length)
  2828.          {
  2829.             if(Matrix[_loc2_][_loc1_] == slide)
  2830.             {
  2831.                GoHints(GlobalX + _loc1_ * Size + 7,GlobalY + Size * (_loc2_ - 1));
  2832.                break;
  2833.             }
  2834.             _loc1_ = _loc1_ + 1;
  2835.          }
  2836.          _loc2_ = _loc2_ + 1;
  2837.       }
  2838.    }
  2839.    function ConvertText(hint)
  2840.    {
  2841.       var _loc4_ = "";
  2842.       var _loc2_ = 0;
  2843.       var _loc1_ = 0;
  2844.       while(_loc1_ < hint.length)
  2845.       {
  2846.          var _loc3_ = hint.substr(_loc1_,1);
  2847.          if(_loc3_ == "|")
  2848.          {
  2849.             if(_loc2_ > Letter)
  2850.             {
  2851.                Letter = _loc2_;
  2852.             }
  2853.             _loc2_ = 0;
  2854.             _loc4_ += "\n";
  2855.             Lines++;
  2856.          }
  2857.          else
  2858.          {
  2859.             _loc4_ += _loc3_;
  2860.             _loc2_ = _loc2_ + 1;
  2861.          }
  2862.          _loc1_ = _loc1_ + 1;
  2863.       }
  2864.       if(_loc2_ > Letter)
  2865.       {
  2866.          Letter = _loc2_;
  2867.       }
  2868.       return _loc4_;
  2869.    }
  2870.    if(notBlock && !moveart)
  2871.    {
  2872.       if(SoundOn)
  2873.       {
  2874.          hint_s.start();
  2875.       }
  2876.       FromHint();
  2877.       StopHint();
  2878.       ooMouse = {};
  2879.       ooMouse.onMouseDown = FromHint;
  2880.       Mouse.addListener(ooMouse);
  2881.       clearInterval(HHH);
  2882.       hints.removeMovieClip();
  2883.       HH.removeMovieClip();
  2884.       buttonhelp.removeMovieClip();
  2885.       bla.removeMovieClip();
  2886.       var X = 190;
  2887.       var Y = 280;
  2888.       var Lines = 1;
  2889.       var Letter = 1;
  2890.       delete hints;
  2891.       StopTimer();
  2892.       _root.attachMovie("help","hints",_root.getNextHighestDepth());
  2893.       _root.createEmptyMovieClip("HH",_root.getNextHighestDepth());
  2894.       HH.createTextField("hinttext",_root.getNextHighestDepth(),0,0,0,0);
  2895.       _root.attachMovie("buttonhelp","buttonhelp",_root.getNextHighestDepth());
  2896.       hints._width = 330;
  2897.       HH.hinttext.multiline = true;
  2898.       HH.hinttext.autoSize = "left";
  2899.       HH.hinttext.selectable = false;
  2900.       buttonhelp.onPress = FromHint;
  2901.       format = new TextFormat();
  2902.       format.font = "Arial";
  2903.       format.size = "12";
  2904.       format.bold = true;
  2905.       format.color = 12303155;
  2906.       format.align = "center";
  2907.       switch(hint)
  2908.       {
  2909.          case "begin":
  2910.             Y = FindStop(Matrix) * Size + GlobalY;
  2911.             X = 0;
  2912.             HH.hinttext.text = ConvertText(hint0);
  2913.             break;
  2914.          case "art":
  2915.             FindSlide("gslice1");
  2916.             HH.hinttext.text = ConvertText(hint1);
  2917.             break;
  2918.          case "swap":
  2919.             Y = FindStop(Matrix) * Size + GlobalY;
  2920.             X = 0;
  2921.             HH.hinttext.text = ConvertText(hint2);
  2922.             break;
  2923.          case "art2":
  2924.             FindSlide("gslice2");
  2925.             FindSlide("gslice3");
  2926.             HH.hinttext.text = ConvertText(hint3);
  2927.             break;
  2928.          case "time":
  2929.             GoHints(240,300);
  2930.             Y = 200;
  2931.             HH.hinttext.text = ConvertText(hint4);
  2932.             break;
  2933.          case "hammer":
  2934.             FindSlide("hammer");
  2935.             HH.hinttext.text = ConvertText(hint5);
  2936.             break;
  2937.          case "digger":
  2938.             FindSlide("digger");
  2939.             HH.hinttext.text = ConvertText(hint6);
  2940.             break;
  2941.          case "watch":
  2942.             FindSlide("watch");
  2943.             HH.hinttext.text = ConvertText(hint7);
  2944.             break;
  2945.          case "lamp":
  2946.             FindSlide("lamp");
  2947.             HH.hinttext.text = ConvertText(hint8);
  2948.             break;
  2949.          case "hammer2":
  2950.             Y = 200;
  2951.             GoHints(250,320);
  2952.             HH.hinttext.text = ConvertText(hint9);
  2953.             break;
  2954.          case "digger2":
  2955.             Y = 200;
  2956.             GoHints(320,320);
  2957.             HH.hinttext.text = ConvertText(hint10);
  2958.             break;
  2959.          case "watch2":
  2960.             Y = 200;
  2961.             GoHints(395,320);
  2962.             HH.hinttext.text = ConvertText(hint11);
  2963.             break;
  2964.          case "lamp2":
  2965.             Y = 200;
  2966.             GoHints(455,320);
  2967.             HH.hinttext.text = ConvertText(hint12);
  2968.       }
  2969.       HH.hinttext.setTextFormat(format);
  2970.       hints._height = 25 + (Lines + 1) * 15;
  2971.       hints._width = 20 + (Letter + 1) * 6;
  2972.       buttonhelp._y = Y + (Lines + 1) * 15 + 3;
  2973.       hints._x = X;
  2974.       hints._y = Y;
  2975.       HH._x = X + 15;
  2976.       HH._y = Y + 10;
  2977.       buttonhelp._x = X + hints._width / 2 - 10;
  2978.    }
  2979. }
  2980. function CheckSuccess(i1, j1, i2, j2)
  2981. {
  2982.    if(Matrix[i1][j1] != undefined && Matrix[i1][j1] != "0" && Matrix[i2][j2] != "0" && Matrix[i2][j2] != undefined && Matrix[i2][j2].substr(0.1) != "l")
  2983.    {
  2984.       if(SoundOn)
  2985.       {
  2986.          var _loc1_ = false;
  2987.          _loc1_ = Finding(i1,j1,i2,j2);
  2988.          if(!_loc1_)
  2989.          {
  2990.             _loc1_ = Finding(i2,j2,i1,j1);
  2991.          }
  2992.          if(_loc1_)
  2993.          {
  2994.             yes_s.start();
  2995.          }
  2996.          else
  2997.          {
  2998.             no_s.start();
  2999.          }
  3000.       }
  3001.    }
  3002. }
  3003. stop();
  3004. RedyToPlay = redytoend = false;
  3005. fromhint = true;
  3006. MaxC = countries.length - 1;
  3007. N = 3;
  3008. Life = 3;
  3009. NextLife = 35000;
  3010. NumTail = 20;
  3011. TailPeriod = 100;
  3012. RoundSity = 0;
  3013. mmm = Add = RoundCountry = score = 0;
  3014. Hammer = Lamp = Digger = Watch = 0;
  3015. SoundOn = hbegin = hart = hart2 = htime = hswap = hhammer = hhammer2 = hwatch = hwatch2 = hlamp = hlamp2 = hdigger = hdigger2 = true;
  3016. ArtX = 15;
  3017. ArtY = 30;
  3018. var Speed = 0;
  3019. Step = 5;
  3020. Size = 32;
  3021. Size1 = 29;
  3022. HamX = 249;
  3023. HamY = 349;
  3024. LamX = 448;
  3025. LamY = 348;
  3026. DigX = 320;
  3027. DigY = 348;
  3028. WatX = 390;
  3029. WatY = 348;
  3030. GameSpeed = 400;
  3031. oKey = {};
  3032. oKey.onKeyDown = function()
  3033. {
  3034.    if(Key.getAscii() == String("c").charCodeAt())
  3035.    {
  3036.       delete ArtPos;
  3037.       ArtPos = new Array();
  3038.       if(Key.isDown(38))
  3039.       {
  3040.          RoundSity = 5;
  3041.          RoundCountry = 0;
  3042.          EndRound();
  3043.       }
  3044.       if(Key.isDown(40))
  3045.       {
  3046.          GameOver();
  3047.       }
  3048.       if(Key.isDown(37))
  3049.       {
  3050.          Life = 0;
  3051.          GameOver();
  3052.       }
  3053.       if(Key.isDown(39))
  3054.       {
  3055.          RoundSity = 8;
  3056.          RoundCountry = 2;
  3057.          EndRound();
  3058.       }
  3059.       InitArt(RoundCountry,RoundSity);
  3060.    }
  3061. };
  3062. Key.addListener(oKey);
  3063. dig.useHandCursor = false;
  3064. this.attachMovie("helppanel","help",this.getNextHighestDepth());
  3065. delete ArtPos;
  3066. ArtPos = new Array();
  3067. InitArt(RoundCountry,RoundSity);
  3068.